How to remove header images from all pages except the home page? skeleton theme

The following one-liner removes regular header images: ! is_admin() && is_front_page() && add_filter( ‘theme_mod_header_image’, ‘__return_false’ ); Usually, header images are saved and retrieved per Theme Modification API, which offers the same filter scheme “theme_mod_$name” for all theme data. Update I see now, the theme is using the post thumbnail as header images on single views: … Read more

How can I add a class to a single menu item?

In the Appearance > Menus panel, you can expose custom class fields by clicking the “Screen Options” tab at the top of the page. From there, each menu item will have a custom css field labeled “CSS Classes (optional)” where an admin can put any plain text class name.

WordPress Google Maps in Custom Theme

Enqueue your script and use wp_localize_script to pass data. function wpd_scripts() { wp_enqueue_script( ‘wpd_script’, get_stylesheet_directory_uri() . ‘/js/script.js’, null, null, false ); wp_localize_script( ‘wpd_script’, ‘WPD’, array( ‘stylesheet_dir’ => get_stylesheet_directory_uri() ) ); } add_action( ‘wp_enqueue_scripts’, ‘wpd_scripts’ ); You can then use WPD.stylesheet_dir in your script to get the value you set in PHP. var marker_url = WPD.stylesheet_dir … Read more

Style.css redirects to 404 Page not found

Your directory permissions for your Theme directory are incorrect. wp-content: 0755 wp-content/themes: 0755 wp-content/themes/kenchristy: 0700 Per the Codex, folder permissions should be set to 755: In such an suexec configuration, the correct permissions scheme is simple to understand. All files should be owned by the actual user’s account, not the user account used for the … Read more

Custom post type archive sorted and grouped by date in post meta field

OK, so this problem has two parts: Make WordPress to sort these posts properly. Make WordPress to display them with all that grouping. 1. Sorting CPT by meta value on archive You can use pre_get_posts to achieve this. add_action( ‘pre_get_posts’, function ( $query ) { if ( is_post_type_archive( ‘event’ ) && $query->is_main_query() ) { $query->set( … Read more

Two queries on the same page with pagination

Please use below code hope it’s work for you <div class=”row list-group”> <?php function query_group_by_filter($groupby){ global $wpdb; return $wpdb->postmeta . ‘.meta_value ‘; } global $paged, $wp_query, $wp; $args = wp_parse_args($wp->matched_query); if ( !empty ( $args[‘paged’] ) && 0 == $paged ) { $wp_query->set(‘paged’, $args[‘paged’]); $paged = $args[‘paged’]; } $temp = $wp_query; $wp_query= null; add_filter(‘posts_groupby’, ‘query_group_by_filter’); … Read more

Get last modified date for menu link

The nav_menu_link_attributes filter can be used to accomplish this, so a walker is not necessary. Here’s an example with comments along the way to explain what’s happening. add_filter( ‘nav_menu_link_attributes’, ‘wpse_nav_menu_link_attributes’, 10, 4 ); /** * Filters the HTML attributes applied to a menu item’s anchor element. * * Adds data-modified attribute to links. * – … Read more