How to Access Functions.php | Video

What is Functions.php

WordPress offers extensive customization to your wordpress website. You can edit functionality, looks any way you want to by inserting your own code in the “functions.php” of your wordpress website.

Functions.php comes with the theme and as it is suggested by name, it stores theme’s functions. You can customize your website by manipulating functions.php’s code.. There are two ways you can access the functions.php. It can be either access by a FTP client or it can be accessed in wordpress’s administrator dashboard through browser.

Access functions.php By Using a FTP Client

  1. Open FTP client, Connect to your website by providing FTP Login credentials.
  2. Locate Functions.php by going to the directory below:
    [WordPress Website’s Root]> wp-content > Themes > [current_theme_name] > functions.php.
  3. Download the functions file and update the file with required code.
  4. Upload the file to replace the theme’s function.php with changes made to the file.

Access functions.php Through WordPress Dashboard

  1. Sign-in to your WordPress administrator account.
  2. From sidebar, Select “Appearance > Editor”
  3. Select the theme from “Select theme to edit” drop-down menu.
  4. Under “Theme Files”, “Templates” section, Find and click “Themes Functions (functions.php)”.
  5. Click “Update File” After Making the required updates to the file and to save the changes made to the functions file.

Video Tutorial

You can reach Waqas Yousaf through twitter @wiqi.

Read More
Waqas Yousaf January 10, 2018 0 Comments

Change WordPress Admin Panel’s Footer Text

Wordpress admin footer

Default wordpree admin footer text

Basically, Any web developer (including myself) takes a step further when it comes to branding.  With the following code, You can change the old and boring wordpress’ footer text and replace it  your own message.

Just go to functions.php of your theme and add the following code.

[php] function my_admin_footer () {
print "Your Company Name. <a href=’#’>Visit Website</a>";
}

add_filter(‘admin_footer_text’, ‘my_admin_footer’);
[/php]

Happy Experimenting!

 

[alert type=”warning” close=”true”]You’ll have to edit your theme’s functions file. If you dont know how to do it, Check out WordPress’ Guide on functions.php before proceeding.[/alert]

Read More
Waqas Yousaf April 4, 2017 0 Comments

Removing WordPress Menu Items with Single Click

As a web developer working on website, All I know is time is money and during developing a website, there is one thing I hated the most. “Deleting menu items”. You see when I want to remove a menu item in WordPress, I go to [highlight2]Appearance -> Menus[/highlight2]  in admin Panel and then I remove the items one by one by expanding the menu item and using Remove to delete single item. Imagine when you have to remove an entire submenu consisting dozens of links. This exercise becomes excoriating painful.

The Solution

Meet One Click Remove Menu

  1. Just download and install this tiny plugin
  2. A little trash can button would appear on the menu item.
  3. Just delete as many items you want to without expanding and finding tiny remove link .

Thats it, Menu Item deleted.

 

 

Read More
Waqas Yousaf March 27, 2017 0 Comments

Create banned words list for WP titles

Why do you need a banned word list for titles?

Running a blog with multiple authors is such a nightmare. You got to deal with many things and on the top of the all you also got to look for the content being posted on the blogs.

You can either reduce the access level of bloggers and read all the content first by yourself and then publish it but it would take like forever and it would only add another task to your responsibilities. Then there is this way, in which you can add words you want to ban on the website and WordPress simply won’t let the bloggers add the titles with the banned words itself. Problem Solved.

How Do I Access Functions.php?

You’ll have to add this tiny function and a hook in your functions.php file which is stored in your theme’s directory.

CAUTION: BACKUP YOUR WEBSITE BEFORE DOING ATTEMPTING CHANGES. I WONT BE RESPONSIBLE FOR ANY MISHAP.

Code

[php] function wpb_title_bws($sTitle)
{
$BannedWords = "abc,xyz,omg"; // Banned words seperated by comma.
$BannedWords = explode(",", $BannedWords);

global $post;
$sTitle = $post->post_title;

foreach($BannedWords as $BannedWord)
{
if (stristr($sTitle, $BannedWord))
wp_die( __(‘Error: Remove the banned word "’. $BannedWord .’" in post title first!’) );
}
}

add_action(‘publish_post’, ‘wpb_title_bws’, 10, 1);
[/php]

 

You can reach Waqas Yousaf through twitter @wiqi.

Read More
Waqas Yousaf October 19, 2016 10 Comments

Running wordpress shortcodes in widgets

WordPress bares to add shortcodes to widges, wordpress would tweet shortcodes just as regular text. Its good thing by security point of view but you can make short codes run in widgets. All you have to do is to add this little piece of code in functions.php

[php] add_filter(‘widget_text’, ‘do_shortcode’);
[/php]

and thats about it. happy experimenting.

Read More
Waqas Yousaf October 13, 2016 0 Comments