Page attribute template dropdown not displayed even the syntax is correct

If you’re wanting to enable the Page Template dropdown for a custom post type, you have to enable support for “page attributes” when you define your CPT. You should currently have something like register_post_type(‘foo’, array(‘labels’ => array( … ), ); You need to add ‘supports’: register_post_type(‘foo’, array(‘labels’ => array( … ), ‘supports’ => array(‘title’, ‘editor’, … Read more

Details of wp_localize_script

wp_localize_scripts writes content to the page in the form of a Javascript object that can be accesses by other Javascript that runs on the page. The point is to be able to pass dynamic data to the executing Javascript without having to make AJAX requests, parse the page for data (extract the post ID from … Read more

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

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

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