Category: WordPress

Yoast Breadcrumbs for Custom Post Types and Blog Posts

There are a couple tricky settings that affect how Yoast’s breadcrumbs display for Custom Post Types and Blog Posts. It can be a bit frustrating when breadcrumbs are not displaying correctly and you don’t know why. I figured out today, it’s all in the settings. Custom Post Types Breadcrumbs When…

Deleting Pages and SEO

When you have a page on the site that isn’t relevant anymore, what should you do? The page is indexed by Google so might show up in Google searches and other sites might have linked to it, but so-and-so is no longer with your company or the event has passed….

WordPress’ Privacy Policy Guide

WordPress 4.9.6 included the following Privacy Policy Guide. It is a bit buried in the admin though (/wp-admin/tools.php?wp-privacy-policy-guide) so I copied it here for clients to view.  It is intended to help create a Privacy Policy that complies with the new GDPR. Below is copied from WordPress’ Privacy Policy Guide…

Remove Post Tags from WordPress Admin

Remove from Posts sub menu in left side WordPress Admin Menu: function unbox_change_menus () { remove_submenu_page( ‘edit.php’, ‘edit-tags.php?taxonomy=post_tag’ ); } add_action(‘admin_menu’, ‘unbox_change_menus’); Remove Tags column from List of Posts in Admin: add_filter(‘manage_posts_columns’, ‘unbox_custom_columns_posts’); function unbox_custom_columns_posts( $defaults ) { unset($defaults[‘tags’]); //remove tags return $defaults; } Remove Tags Side Box when editing/creating…

Single Post Template Functions

Get the date – always prints date even if on second post on same day. $post_id is optional if inside of posts loop. See Formatting_Date_and_Time for $format value. <?php $date = get_the_date( $format, $post_id ); ?> does not print date if displaying second post on same day in loop. <?php the_date()…

Retrieve Pages by Path or Template in WordPress

By Template: $pages_using_template = get_pages(array( ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘template-press-release-list.php’, ‘post_status’ => ‘publish’, ‘post_type’ => ‘page’, ‘hierarchical’ => 0 //because page looking for could have a parent – without this only gets top level pages. )); Check if got anything and use it from query above: if($pages_using_template && count($pages_using_template)…

WordPress Menu Functions

wp_get_nav_menu_items( string $menu, array $args = array() ) Returns an array of menu items. $menu parameter is slug or id of Menu created in WordPress. $args is from here: get_posts, which isn’t very helpful for filtering what menu items you want to display.  This function returns an array that you…

Category Template Tags

The following functions can be used on the category.php template to display information about the current category. Display Current Category Title on category.php: <?php single_cat_title(); ?> <?php single_term_title(); // more generic – can be used on archive.php too ?> Display Current Category Description: <?php echo category_description(); ?> Get Current Category…