Numbered Search Results in WordPress

I needed to show search results in an ordered list for a project I am working on and was very surprised to discover how involved this is for paginated search results. Showing the results using a regular ordered list starts the list numbering over at 1 on each new page of results, even though the …

Read more »

Genesis: Remove/Change post info/post meta

// Remove post meta remove_action('genesis_after_post_content', 'genesis_post_meta'); // Customize the post meta function add_filter('genesis_post_meta', 'post_meta_filter'); function post_meta_filter($post_meta) { if (!is_page()) { // Spaces are added to [ shortcodes ] for display. Do not include. $post_meta = 'Filed Under: [ post_categories ], Tagged: [ post_tags ]'; return $post_meta; }} // Remove the post info function remove_action('genesis_before_post_content', 'genesis_post_info'); …

Read more »

Genesis: Custom loop arguments

remove_action('genesis_loop', 'genesis_do_loop'); add_action('genesis_loop', 'custom_do_cat_loop'); function custom_do_cat_loop() { global $query_args; // any wp_query() args $args= array('orderby' => 'title', 'order' => 'ASC'); genesis_custom_loop(wp_parse_args($query_args, $args)); }

Genesis: Custom Page Template

<?php // Template Name: Template Name Here remove_action('genesis_loop', 'genesis_do_loop'); add_action('genesis_loop', 'custom_loop'); function custom_loop() { global $paged; $args = array('post_type' => 'PostType'); // any wp_query args can go here genesis_custom_loop( $args ); } genesis();

Genesis: Default Post Thumbnail

// Default post thumbnail add_filter('genesis_get_image', 'default_image_fallback', 10, 2); function default_image_fallback($output, $args) { global $post; if( $output || $args['size'] == 'full' ) return $output; $thumbnail = CHILD_URL.'/images/thumb.jpg'; switch($args['format']) { case 'html' : return '<img src="'.$thumbnail.'" class="alignleft post-image" alt="'. get_the_title($post->ID) .'" />'; break; case 'url' : return $thumbnail; break; default : return $output; break; } }

Genesis Grid Loop

New in Genesis 1.5 CSS: /* Featured Post Grid ———————————————————— */ .genesis-grid-even { float: right; padding: 0 0 15px; width: 48%; } .genesis-grid-odd { clear: both; float: left; padding: 0 0 15px ; width: 48%; } .genesis-grid-even, .genesis-grid-odd { margin: 0 0 20px; } PHP: /* functions.php: ———————————————————— */ add_image_size('grid-thumbnail', 100, 100, TRUE); /* home.php: …

Read more »

Genesis: Custom search button and search form text

// Search form text add_filter('genesis_search_text', 'custom_search_text'); function custom_search_text($text) { return esc_attr('Search…'); } // Add custom text for search button add_filter('genesis_search_button_text', 'custom_search_button_text'); function custom_search_button_text($text) { return esc_attr('Go'); }

Genesis Footer Content

Customize the footer text add_filter('genesis_footer_creds_text', 'custom_footer_creds_text'); function custom_footer_creds_text($creds) { $creds = '&copy;' . date('Y') . ' ' . get_bloginfo('name') . '. All rights reserved. Powered by <a href="http://wordpress.org/">WordPress</a>.'; echo $creds; } Remove Footer Content This will remove the footer credits text and ‘back to top’ link. add_filter('genesis_footer_output', 'footer_output_filter', 10, 1); function footer_output_filter($footer_content) { $footer_content = …

Read more »

Genesis: Custom superfish arguments

// functions.php function custom_superfish_menu() { if ( genesis_get_option('nav_superfish') ) { wp_deregister_script('superfish-args'); wp_enqueue_script('superfish-args', CHILD_URL.'/superfish.args.js', array('jquery'), '1.0', TRUE); } } add_action('get_header', 'custom_superfish_menu'); // superfish.args.js jQuery(document).ready(function($) { $('#nav ul.superfish, #subnav ul.superfish, #header ul.nav, #header ul.menu').superfish({ delay: 0, // delay on mouseout speed: 'fast', animation: {opacity:'show',height:'show'}, // fade-in and slide-down animation autoArrows: false, dropShadows: false, // disable drop shadows …

Read more »

Genesis: Parent Page Templates

The template below displays child posts below any page content of the parent post with featured image thumbnails. Images are linked to child page. If there is an image before any page content on the child page, it will not display in order to avoid breaking the layout on posts with large images. To display …

Read more »

genesis();

This is what happens when you call the genesis() function: function genesis() { get_header(); genesis_before_content_sidebar_wrap(); ?> <div id="content-sidebar-wrap"> <?php genesis_before_content(); ?> <div id="content" class="hfeed"> <?php genesis_before_loop(); genesis_loop(); genesis_after_loop(); ?> </div><!– end #content –> <?php genesis_after_content(); ?> </div><!– end #content-sidebar-wrap –> <?php genesis_after_content_sidebar_wrap(); get_footer(); }

Define Genesis default options

// Define Genesis Options add_filter('genesis_options', 'define_genesis_setting_custom', 10, 2); function define_genesis_setting_custom($options, $setting) { if($setting == GENESIS_SETTINGS_FIELD) { $options['update'] = 1; $options['blog_title'] = 'text'; $options['header_right'] = 0; $options['site_layout'] = 'content-sidebar'; $options['nav'] = 1; $options['nav_superfish'] = 1; $options['nav_home'] = 1; $options['nav_type'] = 'pages'; $options['nav_pages_sort'] = 'menu_order'; $options['nav_categories_sort'] = 'name'; $options['nav_depth'] = 0; $options['nav_extras_enable'] = 0; $options['nav_extras'] = 'date'; …

Read more »

Remove Genesis Distractions

Remove Genesis options page remove_action('admin_menu', 'genesis_add_admin_menu'); Remove in-post layout and SEO boxes remove_action('admin_menu', 'genesis_add_inpost_layout_box'); remove_action('admin_menu', 'genesis_add_inpost_seo_box'); Unregister Site Layouts // Register default site layout option genesis_set_default_layout( 'full-width-content' ); // Unregister other site layouts genesis_unregister_layout( 'content-sidebar' ); genesis_unregister_layout( 'sidebar-content' ); genesis_unregister_layout( 'content-sidebar-sidebar' ); genesis_unregister_layout( 'sidebar-sidebar-content' ); genesis_unregister_layout( 'sidebar-content-sidebar' );

Genesis: Disable SEO Functions

function genesis_disable_seo_functons() { remove_filter('wp_title', 'genesis_default_title', 10, 3); remove_action('get_header', 'genesis_doc_head_control'); remove_action('genesis_meta','genesis_seo_meta_description'); remove_action('genesis_meta','genesis_seo_meta_keywords'); remove_action('genesis_meta','genesis_robots_meta'); remove_action('wp_head','genesis_canonical'); add_action('wp_head', 'rel_canonical'); remove_action('admin_menu', 'genesis_add_inpost_seo_box'); remove_action('save_post', 'genesis_inpost_seo_save', 1, 2); remove_action('admin_init', 'genesis_add_taxonomy_seo_options'); remove_action('edit_term', 'genesis_term_meta_save', 10, 2); remove_action('show_user_profile', 'genesis_user_seo_fields'); remove_action('edit_user_profile', 'genesis_user_seo_fields'); remove_action('personal_options_update', 'genesis_user_meta_save'); remove_action('edit_user_profile_update', 'genesis_user_meta_save'); remove_theme_support('genesis-seo-settings-menu'); add_filter('pre_option_' . GENESIS_SEO_SETTINGS_FIELD, '__return_empty_array'); }