﻿1
00:00:00,430 --> 00:00:06,200
In this video you'll make a change to the Wordpress dashboard instead of the front facing Web site.

2
00:00:06,600 --> 00:00:12,510
This is accomplished through editing the functions that BHP file within the active theme to keep the

3
00:00:12,510 --> 00:00:15,300
parent theme from losing changes when updated.

4
00:00:15,300 --> 00:00:17,080
This should be done elsewhere.

5
00:00:17,100 --> 00:00:20,300
In our case the child theme is the perfect place.

6
00:00:20,520 --> 00:00:25,980
You'll use a code snippet from WordPress start to remove a menu item from the Wordpress dashboard in

7
00:00:25,980 --> 00:00:32,830
a way that it hears to best practices since we're going to be making some fundamental changes to the

8
00:00:32,830 --> 00:00:35,300
files within our child theme.

9
00:00:35,350 --> 00:00:39,020
It makes sense to make a backup first.

10
00:00:39,190 --> 00:00:45,850
One thing you can do is go to your migration or backup plug in and go ahead an expert export a whole

11
00:00:45,850 --> 00:00:51,700
copy of the site that you know you can re-install if you need to.

12
00:00:51,840 --> 00:00:57,180
Another thing you should do as well is to take the file structure that you're working with and just

13
00:00:57,180 --> 00:01:03,600
create a backup original that you can revert to if you make a mistake or need to upload the old original

14
00:01:03,600 --> 00:01:11,310
files to the file structure knowing that my theme is the affinity child too.

15
00:01:11,370 --> 00:01:20,040
I could go straight to Windows Explorer or via FTB if the site is live and go inside of the file structure

16
00:01:20,040 --> 00:01:23,510
from my site and NWP content themes.

17
00:01:23,580 --> 00:01:30,760
I can see that this whole folder child O2 has a set of files.

18
00:01:30,900 --> 00:01:40,170
So one thing I could do is just right click and create a copy and then I could go outside of my site

19
00:01:40,170 --> 00:01:50,200
say somewhere into my computer like my desktop and I'll create live site and I'll just right click and

20
00:01:50,200 --> 00:01:51,970
I'll paste that copy.

21
00:01:51,970 --> 00:01:59,690
Now I know outside of my site itself I have a copy of the file structure for those theme files.

22
00:01:59,750 --> 00:02:06,290
Now when I open these files from the actual active theme within my code editor I'll know that I have

23
00:02:06,290 --> 00:02:13,340
a backup just in case I make a mistake go ahead and open your code editor and go to the child theme

24
00:02:13,340 --> 00:02:19,690
and open the functions dot ph P file.

25
00:02:19,760 --> 00:02:25,970
The only things in this functions that BHP are in cuing the style sheet like we did when we manually

26
00:02:25,970 --> 00:02:28,520
created our child the files before.

27
00:02:28,880 --> 00:02:36,200
After this comment section I can add any other code snippets or pieces of code that I want to use to

28
00:02:36,200 --> 00:02:39,480
make fundamental changes to my wordpress installation.

29
00:02:40,070 --> 00:02:48,770
You can find plenty of different WordPress code snippets if you just do a search for code snippets WordPress

30
00:02:48,800 --> 00:02:56,230
for example and there are so many different developers making stuff for Wordpress that you can find

31
00:02:56,250 --> 00:02:58,710
a lot of good code snippets.

32
00:02:58,880 --> 00:03:05,660
I found a function referenced inside the Wordpress dot org support area code x that talks about how

33
00:03:05,660 --> 00:03:08,450
to remove a menu page.

34
00:03:08,450 --> 00:03:14,810
For example if I were inside of my wordpress dashboard that I was making this site for a client I might

35
00:03:14,810 --> 00:03:20,990
want to eliminate their ability to add new users and look at all users if they don't need it.

36
00:03:20,990 --> 00:03:26,720
If there's only going to be one administrative user if I get rid of this user's menu all together they'll

37
00:03:26,720 --> 00:03:29,970
still be able to edit their own profile up here.

38
00:03:30,200 --> 00:03:36,790
But the ad users and all need all users pages will be invisible to them.

39
00:03:37,820 --> 00:03:39,000
So how do I do that.

40
00:03:41,410 --> 00:03:48,520
I simply need to find the code snippet that I'm looking for and insert it inside the tags in the existing

41
00:03:48,730 --> 00:03:49,520
functions.

42
00:03:49,750 --> 00:03:51,420
DHP file.

43
00:03:51,550 --> 00:03:54,070
That would be within my child theme.

44
00:03:54,160 --> 00:04:01,000
You can read a little bit about how this function is used but here's an example and you can see that

45
00:04:01,030 --> 00:04:06,260
what it's going to do is remove the menu page for any of these menu items.

46
00:04:06,310 --> 00:04:14,950
If I just want to remove the user's item from the admin dashboard I could simply go over here and just

47
00:04:14,950 --> 00:04:18,630
use the user's line inside of this piece of code.

48
00:04:19,770 --> 00:04:26,130
Now when you add code snippets to the functions that ph profile you don't need the PH P-TECH beginning

49
00:04:26,160 --> 00:04:30,490
or end because that file already has it right there.

50
00:04:32,160 --> 00:04:37,420
So I'm going to go into this function example.

51
00:04:37,650 --> 00:04:43,740
I'll just go ahead and select the whole thing and hit Control C to copy it and I need to go into my

52
00:04:43,740 --> 00:04:50,360
code editor a couple of line breaks past the last item and paste it right in there.

53
00:04:51,400 --> 00:04:57,280
It's nice that the code editor gives us some color syntax highlighting so we can see more easily what's

54
00:04:57,280 --> 00:04:58,620
going on.

55
00:04:58,690 --> 00:05:08,080
I'm going to go ahead and erase all the items that I want to leave and create some code that will just

56
00:05:08,080 --> 00:05:12,710
remove the user's DUP THP file.

57
00:05:12,940 --> 00:05:15,270
That is the user's menu item.

58
00:05:15,400 --> 00:05:16,260
The file itself.

59
00:05:16,270 --> 00:05:19,130
If you browse with the URL is still there.

60
00:05:19,150 --> 00:05:25,120
We're just removing the menu item for any administrator and I'm going to clean up the code a little

61
00:05:25,120 --> 00:05:25,420
bit.

62
00:05:25,420 --> 00:05:29,440
Give it a little space so it's very readable and there it is.

63
00:05:29,440 --> 00:05:34,720
I'll take control s to save and let's take a look.

64
00:05:34,750 --> 00:05:40,910
I refresh the page inside of the administrator dashboard between plugins and tools.

65
00:05:40,910 --> 00:05:47,130
I no longer have a users menu so go ahead and give that a try.

66
00:05:47,140 --> 00:05:54,260
Update the admin page removing the user menu using the same function reference that I found.

67
00:05:54,430 --> 00:06:02,500
I did find that page inside of the Wordpress darg codecs by searching for Remove admin menu and it was

68
00:06:02,500 --> 00:06:11,190
the first function reference called remove menu page inside of Wordpress or pause the video now and

69
00:06:11,190 --> 00:06:13,590
make that edit to the administration page.

70
00:06:13,650 --> 00:06:14,820
If you haven't already

71
00:06:17,890 --> 00:06:19,800
great Chanuka.

72
00:06:20,350 --> 00:06:22,170
Well here's another challenge for you.

73
00:06:22,210 --> 00:06:28,240
I'd like you to follow along with me here while I go to the current theme and hit Ed.

74
00:06:31,920 --> 00:06:37,620
And under the affinity child to the style sheet that we're using is here and the theme functions Doppie

75
00:06:37,640 --> 00:06:39,980
HP files here.

76
00:06:40,160 --> 00:06:47,810
I'd like you to go into the Wordpress code editor here and under themed functions functions dot ph p.

77
00:06:47,960 --> 00:06:54,610
Go ahead and remove that semi-colon and then let's go ahead and update the file.

78
00:06:58,570 --> 00:07:00,760
Oops we've been here before.

79
00:07:00,850 --> 00:07:03,120
Inside of one of the other chapters.

80
00:07:03,130 --> 00:07:11,700
But now both the admin dashboard and the site itself are going to give us the white screen of death.

81
00:07:11,800 --> 00:07:13,540
Oh my.

82
00:07:13,540 --> 00:07:23,530
Even if you go back to the U R L for for the dashboard itself it's not going to work.

83
00:07:23,530 --> 00:07:31,390
We've broken the site by making a mistake in our code inside of the functions dot ph P file.

84
00:07:31,390 --> 00:07:37,210
Your challenge is to restore the site back to working again any way that you can give it a go.

85
00:07:38,690 --> 00:07:39,860
Well how did it go.

86
00:07:39,860 --> 00:07:44,710
Were you able to get back and replace the functions up here HP file with your backup.

87
00:07:45,080 --> 00:07:50,730
Or maybe you just edited that file and added the semi-colon that we had mistakenly taken out before

88
00:07:50,990 --> 00:07:52,870
and then refresh and fix the site.

89
00:07:53,780 --> 00:07:58,460
Those are the two options and I'll show you as I go ahead and do it.

90
00:07:58,510 --> 00:08:03,860
There's the functions that BHP file and it's actually updated itself within my code editor because I

91
00:08:03,860 --> 00:08:06,050
can see what's going on there.

92
00:08:06,080 --> 00:08:15,980
Now one of the things that I can do is go over to a different place inside of the windows explorer and

93
00:08:15,980 --> 00:08:18,740
actually hear let me open up my backup.

94
00:08:18,740 --> 00:08:24,050
This is live site infinity Here's my backup file called functions.

95
00:08:24,050 --> 00:08:24,430
All right.

96
00:08:24,440 --> 00:08:30,890
I'm going to right click and go ahead and actually you know what I do I'm going to just copy that file

97
00:08:30,890 --> 00:08:35,450
over by holding control into that theme.

98
00:08:35,630 --> 00:08:42,380
The theme folder and I'm going to go ahead and copy and replace it that way it doesn't matter what mistake

99
00:08:42,380 --> 00:08:43,020
I made.

100
00:08:43,160 --> 00:08:47,080
I am replacing that file with my original.

101
00:08:47,420 --> 00:08:51,260
And now that it's copied it over the new site should work.

102
00:08:51,290 --> 00:08:52,230
Let's check it out.

103
00:08:53,970 --> 00:08:57,760
Refresh the page.

104
00:08:57,990 --> 00:08:59,800
Take a deep breath.

105
00:08:59,850 --> 00:09:04,550
You've restored the website to normal great.

106
00:09:04,550 --> 00:09:09,500
How about the dashboard area.

107
00:09:09,570 --> 00:09:10,240
Who.

108
00:09:10,500 --> 00:09:12,880
Well that says something about Cowboy coding.

109
00:09:12,900 --> 00:09:15,530
You really should be working in a staging area.

110
00:09:15,570 --> 00:09:20,040
That's separate from your live site while you make any fundamental changes.

111
00:09:20,040 --> 00:09:24,420
Just in case you go ahead and break the Web site and then have to fix it again.

112
00:09:24,840 --> 00:09:32,560
So if I look under appearance themes and then in the editor I can now access the functions that P.H.

113
00:09:32,700 --> 00:09:36,690
file and it's back to where it was before.

114
00:09:36,780 --> 00:09:44,370
Of course the changes that I had made under under the functions that BHP have been replaced because

115
00:09:44,700 --> 00:09:47,840
I didn't make a backup after I made those code changes.

116
00:09:47,910 --> 00:09:54,780
So if I wanted want to have that function I would go back and replace what I had been doing this time

117
00:09:55,020 --> 00:09:58,340
making sure that I include the semi-colon that's needed.

118
00:10:00,370 --> 00:10:07,030
For now though I'm going to leave that edit out of our functions that ph P and leave it the way it was

119
00:10:07,030 --> 00:10:13,390
before because I actually do want the users button right there in case I need to use it later.

120
00:10:15,940 --> 00:10:21,820
In this video you edited the functions that P-H profile of the child theme in your local environment.

121
00:10:22,060 --> 00:10:27,150
You looked up a code snippet and pasted an edited version into the file making a change to the Wordpress

122
00:10:27,160 --> 00:10:28,310
dashboard.

123
00:10:28,480 --> 00:10:34,600
You also broke the Web site by missing an important semi-colon and fixed it by accessing the file and

124
00:10:34,600 --> 00:10:37,430
fixing your mistake in the next video.

125
00:10:37,480 --> 00:10:43,330
You'll log into your students sandbox at W.P. of course dot com and configure your first Genesys child

126
00:10:43,330 --> 00:10:44,790
theme using the custom either

