{ /* // Place your snippets for PHP here. Each snippet is defined under a snippet name and has a prefix, body and // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the // same ids are connected. // Example: "Print to console": { "prefix": "log", "body": [ "console.log('$1');", "$2" ], "description": "Log output to console" } */ "Remove Header Right Widget Area": { "prefix": "remove_header_right_widget_area", "body": [ "// Remove header right widget area.", "unregister_sidebar( 'header-right' );" ], "description": "Remove Header Right Widget Area" }, "Register Widget Area": { "prefix": "rwa", "body": [ "// Register `${1:home-featured}` widget area.", "genesis_register_widget_area(", " array(", " 'id' => '${1:home-featured}',", " 'name' => __( '${2:Home Featured}', 'my-theme-text-domain' ),", " 'description' => __( 'This is the ${3:home featured} section.', 'my-theme-text-domain' ),", " )", ");" ], "description": "Register a widget area in Genesis." }, "Register Multiple Widget Areas": { "prefix": "register_multiple_Widget_areas", "body": [ "// Register ${1:front-page} widget areas.", "for ( \\$i = 1; \\$i <= 4; \\$i++ ) {", " genesis_register_widget_area(", " array(", " 'id' => \"${1:front-page}-{\\$i}\",", " 'name' => __( \"${2:Front Page} {\\$i}\", 'my-theme-text-domain' ),", " 'description' => __( \"This is the ${3:front page} {\\$i} section.\", 'my-theme-text-domain' ),", " )", " );", "}" ], "description": "Register Multiple Widget Areas" }, "Display Widget Area": { "prefix": "dwa", "body": [ "// Display `${1:home-featured}` widget area.", "genesis_widget_area( '${1:home-featured}', array(", " 'before' => '
',", " 'after' => '
',", ") );" ], "description": "Display a widget area in Genesis." }, "Register Custom Image Size": { "prefix": "register_custom_image_size", "body": [ "// Register custom size for images on ${1:content archives}.", "add_image_size( '${2:content-archive-image}', ${3:800}, ${4:500}, true );" ], "description": "Register Custom Image Size" }, "Published Post Date": { "prefix": "date", "body": [ "// date.", "echo do_shortcode( '[post_date]' );" ], "description": "Published Post Date in Genesis" }, "Display Featured Image": { "prefix": "image", "body": [ "if ( has_post_thumbnail() ) {", " // get the URL of featured image.", " \\$image_url = genesis_get_image( 'format=url&size=large' );", "} else {", " // a placeholder.", " \\$image_url = 'http://lorempixel.com/1024/1024';", "}", "", "// get the alt text of featured image.", "\\$thumb_id = get_post_thumbnail_id( get_the_ID() );", "\\$alt = get_post_meta( \\$thumb_id, '_wp_attachment_image_alt', true );", "", "// if no alt text is present for featured image, set it to entry title.", "if ( '' === \\$alt ) {", " \\$alt = the_title_attribute( 'echo=0' );", "}", "", "// display the image.", "printf( '
\"%s\"
', \\$image_url, \\$alt );" ], "description": "Display Featured Image in Genesis" }, "URL of Featured Image": { "prefix": "image_url", "body": [ "// get the URL of featured image.", "\\$image_url = genesis_get_image( 'format=url&size=large' );" ], "description": "URL of featured image in Genesis" }, "Entry Title": { "prefix": "title", "body": [ "// title.", "genesis_do_post_title();" ], "description": "Entry Title in Genesis" }, "Remove Primary Nav": { "prefix": "remove_primary_nav", "body": [ "// Remove the primary navigation menu.", "remove_action( 'genesis_after_header', 'genesis_do_nav' );" ], "description": "Remove Primary Nav in Genesis" }, "Add Categories and Tags Support to CPT": { "prefix": "add_categories_and_tags_support_to_cpt", "body": [ "// Add Categories and Tags support to `${1:portfolio}` CPT.", "add_action( 'init', 'sk_add_category_tag_${1:portfolio}' );", "function sk_add_category_tag_${1:portfolio}() {", " register_taxonomy_for_object_type( 'category', '${1:portfolio}' );", " register_taxonomy_for_object_type( 'post_tag', '${1:portfolio}' );", "}" ], "description": "Add Categories and Tags support to CPT in WordPress" }, "Remove Footer Widgets": { "prefix": "remove_footer_widgets", "body": [ "// Remove Footer Widgets.", "remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );" ], "description": "Remove Footer Widgets in Genesis" }, "Add Archive Settings Support for CPT": { "prefix": "add_archive_settings_support_for_cpt", "body": [ "// Add Archive Settings option to `${1:portfolio}` CPT.", "add_post_type_support( '${1:portfolio}', 'genesis-cpt-archives-settings' );" ], "description": "Add Archive Settings support for CPT in Genesis" }, "Full Width Page Template": { "prefix": "full_width_page_template", "body": [ " '
',", " 'context' => 'adjacent-entry-pagination',", " ) );", "", " echo '
';", " previous_post_link( '%link', '< Previous' );", " echo '
';", "", " echo '
';", " next_post_link( '%link', 'Next >' );", " echo '
';", "", " genesis_markup( array(", " 'close' => '
',", " 'context' => 'adjacent-entry-pagination',", " ) );", "", "}" ], "description": "Customize Links to Previous and Next Entries on Singular Entries" }, "Unregister Primary Sidebar": { "prefix": "unregister_primary_sidebar", "body": [ "// Unregister primary sidebar.", "unregister_sidebar( 'sidebar' );" ], "description": "Unregister Primary Sidebar" }, "Unregister Secondary Sidebar": { "prefix": "unregister_secondary_sidebar", "body": [ "// Unregister secondary sidebar.", "unregister_sidebar( 'sidebar-alt' );" ], "description": "Unregister Secondary Sidebar" }, "Add Post Navigation for Single Posts": { "prefix": "add_post_navigation_for_single_posts", "body": [ "// Add post navigation.", "add_action( 'genesis_after_loop', 'genesis_prev_next_post_nav' );" ], "description": "Add Post Navigation for Single Posts" }, "Customize Previous Page and Next Page text in Content Archives Post Navigation": { "prefix": "customize_previous_page_and_next_page_text_in_content_archives_post_navigation", "body": [ "add_filter ( 'genesis_prev_link_text' , 'sp_previous_page_link' );", "/**", " * Customize the previous page link.", " *", " * @param string \\$text Default text for previous page link, \"Previous Page\".", " * @return Modified previous page link text.", " */", "function sp_previous_page_link ( \\$text ) {", " return g_ent( '« ' ) . __( '${1:Previous Page}', CHILD_DOMAIN );", "}", "", "add_filter ( 'genesis_next_link_text' , 'sp_next_page_link' );", "/**", " * Customize the next page link.", " *", " * @param string \\$text Default text for next page link, \"Next Page\".", " * @return Modified next page link text.", " */", "function sp_next_page_link ( \\$text ) {", " return __( '${2:Next Page}', CHILD_DOMAIN ) . g_ent( ' » ' );", "}" ], "description": "Customize Previous Page and Next Page text in Content Archives Post Navigation" }, "Split Entries into Columns": { "prefix": "columns", "body": [ "add_filter( 'post_class', 'custom_portfolio_post_class' );", "/**", " * Display as Columns.", " *", " * @param string \\$classes Existing post classes.", " * @return Modified post classes.", " */", "function custom_portfolio_post_class( \\$classes ) {", " if ( is_main_query() ) { // conditional to ensure that column classes do not apply to Featured widgets", " \\$columns = ${1:3}; // Set the number of columns here", "", " \\$column_classes = array( '', '', 'one-half', 'one-third', 'one-fourth', 'one-fifth', 'one-sixth' );", "", " \\$classes[] = \\$column_classes[ \\$columns ];", "", " global \\$wp_query;", "", " if ( 0 == \\$wp_query->current_post || 0 == \\$wp_query->current_post % \\$columns ) {", " \\$classes[] = 'first';", " }", " }", "", " return \\$classes;", "}" ], "description": "Split Entries into Columns" }, "Remove Archive Pagination": { "prefix": "remove_archive_pagination", "body": [ "// Remove Archive Pagination.", "remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );" ], "description": "Remove Archive Pagination in Genesis" } "Remove entry header": { "prefix": "remove_entry_header", "body": [ "// Remove entry header.", "remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );", "remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );", "remove_action( 'genesis_entry_header', 'genesis_do_post_title' );", "remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );" ], "description": "Remove Entry Header in Genesis" }, "Remove post info": { "prefix": "remove_post_info", "body": [ "// Remove post info.", "remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );" ], "description": "Remove Post Info in Genesis" }, "Remove entry image": { "prefix": "remove_entry_image", "body": [ "// Remove entry image (from theme settings).", "remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );" ], "description": "Remove entry image in Genesis" }, "Remove Entry Footer": { "prefix": "remove_entry_footer", "body": [ "// Remove entry footer.", "remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );", "remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );", "remove_action( 'genesis_entry_footer', 'genesis_post_meta' );" ], "description": "Remove Entry Footer in Genesis" }, "Remove Entry Meta": { "prefix": "remove_entry_meta", "body": [ "// Remove entry meta.", "remove_action( 'genesis_entry_footer', 'genesis_post_meta' );" ], "description": "Remove Entry Meta in Genesis" }, "Modify Read More Link when using the Content Limit": { "prefix": "modify_read_more_link_when_using_the_content_limit", "body": [ "add_filter( 'get_the_content_more_link', 'sp_read_more_link' );", "/**", " * Modify the Genesis content limit read more link.", " *", " * @return Modified read more link for the content limit.", " */", "function sp_read_more_link() {", " return '... ${1:[Continue Reading]}';", "}" ], "description": "Modify Read More Link when using the Content Limit" } "Reposition Footer Widgets": { "prefix": "reposition_footer_widgets", "body": [ "// Reposition footer widgets.", "remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );", "add_action( 'genesis_after', 'genesis_footer_widget_areas' );" ], "description": "Reposition Footer Widgets" }, "Reposition Footer": { "prefix": "reposition_footer", "body": [ "// Reposition footer.", "remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );", "remove_action( 'genesis_footer', 'genesis_do_footer' );", "remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );", "add_action( 'genesis_after', 'genesis_footer_markup_open', 11 );", "add_action( 'genesis_after', 'genesis_do_footer', 12 );", "add_action( 'genesis_after', 'genesis_footer_markup_close', 13 );" ], "description": "Reposition Footer" }, "Template Redirect": { "prefix": "template_redirect", "body": [ "add_filter( 'template_include', 'custom_template_redirect' );", "/**", " * Use ${1:archive-portfolio}.php for ${2:portfolio category and tag taxonomy archives}.", " *", " * @param string \\$template The path of the template to include.", " * @return The filtered path of the template to include.", " */", "function custom_template_redirect( \\$template ) {", " if ( ${3:is_tax( 'portfolio_category' ) || is_tax( 'portfolio_tag' )} ) {", " \\$template = get_query_template( '${1:archive-portfolio}' );", " }", "", " return \\$template;", "}" ], "description": "Template Redirect in WordPress" }, "Customize the WordPress Query": { "prefix": "pre_get_posts", "body": [ "add_action( 'pre_get_posts', '${1:be_exclude_category_from_blog}' );", "/**", " * ${2:Exclude Category from Blog}.", " *", " * @author Bill Erickson", " * @link http://www.billerickson.net/customize-the-wordpress-query/", " * @param object \\$query data.", " */", "function ${1:be_exclude_category_from_blog}( \\$query ) {", " if ( \\$query->is_main_query() && ${3:\\$query->is_home()} ) {", " \\$query->${4:set( 'cat', '-4' )};", " }", "}" ], "description": "Customize the WordPress Query" }, "Enqueue Font Awesome": { "prefix": "font_awesome", "body": [ "wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css' );", ], "description": "Enqueue Font Awesome" } }