Select pages by category

I was able to work this out thanks to the following post How to Add Categories to Pages in WordPress. I needed to modify WP_query to include pages when displaying a list of posts. Below is the solution: In my template file: $args = array( ‘category’ => 25, ‘orderby’ => ‘date’, ‘order’ => ‘ASC’ ); … Read more

Creating a child theme – functions.php code issue

What you miss is that in your code snippet above you failed to name your own parent style. In the code, you posted in the 4th line from above need customization according to the name of your actual parent style. So as an example this line: $parent_style=”parent-style”; // This is ‘twentyfifteen-style’ for the Twenty Fifteen … Read more

Retrieve tags data in post body

There are two ways to approach this: modify the existing the_tags function or build your own. the_tags ultimately relies on get_the_term_list, which returns a list of hyperlinked tags. You would have to use regular expressions to add classes and styles to that using a filter. That would be quite cumbersome. So, my preferred approach would … Read more

Add error message on password protected page ONLY when password introduced was incorrect

Try this: add_filter( ‘the_password_form’, ‘wpse_71284_custom_post_password_msg’ ); /** * Add a message to the password form. * * @wp-hook the_password_form * @param string $form * @return string */ function wpse_71284_custom_post_password_msg( $form ) { // No cookie, the user has not sent anything until now. if ( ! isset ( $_COOKIE[ ‘wp-postpass_’ . COOKIEHASH ] ) ) … Read more

functions.php mistakenly deleted

To fix your site, you should get another functions.php. As such, you can get that from your most recent and operational backup and upload it unto the location of the mistakenly deleted one. In case you don’t have a backup, your last option will be to download a fresh copy of your theme; once that … Read more

How to insert custom widget in custom sidebar in theme activation?

but we have to change some little things if we want this when theme is activated.Changs maded done inside function awesome_register_sidebars.Add below code inside in your theme functions.php file: function awesome_register_sidebars() { $sidebars = array ( ‘a’ => ‘sidebar-footer-1’, ‘b’ => ‘sidebar- footer-2′,’c’=>’sidebar-footer-3’ ); foreach ($sidebars as $sidebar) { register_sidebar( array ( ‘name’ => $sidebar, … Read more

Previous_post and Next_post – Custom Post Type

You want to change the in_same_term value to TRUE as follows: function crunchify_post_navigation(){ ?> <div class=”arrowNav”> <div class=”arrowLeft”> <?php previous_post_link(‘%link’, ‘&#8606;’, TRUE); ?> </div> <div class=”arrowRight”> <?php next_post_link(‘%link’, ‘&#8608;’, TRUE); ?> </div> </div> <?php } add_action(‘wp_footer’, ‘crunchify_post_navigation’);

Why does the ‘wp_nav_menu’ function work only until a menu is created?

This is due to the wp_nav_menu parameter fallback_cb: If the menu doesn’t exist, a callback function will fire. Default is ‘wp_page_menu’. Set to false for no fallback. You have not specified an alternative, so it uses the default, wp_page_menu. You could create your own function to display a page menu with the proper markup, or … Read more