Skip to content

Instantly share code, notes, and snippets.

@ericrasch
Last active July 4, 2017 03:53

Revisions

  1. ericrasch revised this gist Apr 7, 2014. 1 changed file with 0 additions and 7 deletions.
    7 changes: 0 additions & 7 deletions Set Custom WP Feeds.php
    Original file line number Diff line number Diff line change
    @@ -35,11 +35,4 @@ function my_feed_request($qv) {
    }
    add_filter('request', 'my_feed_request');


    /* REGISTER MENUS
    ********************************************************************************************************************************/
    if ( function_exists( 'register_nav_menus' ) ) {
    register_nav_menus( array( 'main nav' => 'Main Navigation' ) );
    }

    ?>
  2. ericrasch revised this gist Feb 3, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Set Custom WP Feeds.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    <?php

    /* =BEGIN: Remove WP generated junk from head
    Source: http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/
    ---------------------------------------------------------------------------------------------------- */
    @@ -38,4 +40,6 @@ function my_feed_request($qv) {
    ********************************************************************************************************************************/
    if ( function_exists( 'register_nav_menus' ) ) {
    register_nav_menus( array( 'main nav' => 'Main Navigation' ) );
    }
    }

    ?>
  3. ericrasch created this gist Feb 3, 2014.
    41 changes: 41 additions & 0 deletions Set Custom WP Feeds.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    /* =BEGIN: Remove WP generated junk from head
    Source: http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/
    ---------------------------------------------------------------------------------------------------- */
    function removeHeadLinks() {
    remove_action( 'wp_head', 'rsd_link' );
    remove_action( 'wp_head', 'wp_generator' );
    remove_action( 'wp_head', 'wlwmanifest_link' );
    remove_action( 'wp_head', 'feed_links_extra', 3 );
    remove_action( 'wp_head', 'feed_links', 2 );
    }
    add_action('init', 'removeHeadLinks');


    /**
    * Create custom RSS feed links (as to not include all the extras)
    * Source: http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/#comment-3980
    */
    function my_custom_feeds() {
    $custom_feed_url = get_bloginfo('rss2_url');
    echo '<link rel="alternate" type="application/rss+xml" title="' . get_bloginfo('name') . ' RSS Feed" href="' . $custom_feed_url . '" />' . "\n";
    }
    add_action('wp_head', 'my_custom_feeds');


    /**
    * Add Custom Post Types/Pages to your main WordPress RSS Feed
    * Source: http://www.wpbeginner.com/wp-tutorials/how-to-add-custom-post-types-to-your-main-wordpress-rss-feed/
    */
    function my_feed_request($qv) {
    if (isset($qv['feed']) && !isset($qv['post_type']))
    $qv['post_type'] = array('page', 'careers');
    return $qv;
    }
    add_filter('request', 'my_feed_request');


    /* REGISTER MENUS
    ********************************************************************************************************************************/
    if ( function_exists( 'register_nav_menus' ) ) {
    register_nav_menus( array( 'main nav' => 'Main Navigation' ) );
    }