WordPress.org

Ready to get started?Download WordPress

Forums

Featured Content
Implementation (1 post)

  1. dianat
    Member
    Posted 11 months ago #

    I am really happy to see WP and core contributors working on this functionality. Thanks, folks.

    I am having a hard time with the implementation. I've reviewed the docs at http://jetpack.me/support/featured-content/. I'm working on Reverie/Foundation. My page files look like:

    <?php get_header(); ?>
    
    		<!-- Row for main content area -->
    		<div id="content" class="eight columns" role="main">
    
    <?php if ( ppri_has_featured_posts( 1 ) && is_home() ) : ?>
        <div class="featured-content">
            <?php get_template_part( 'content-featured.php' ); ?>
        </div>
    <?php endif; ?>
    
    			<div class="post-box">
    				<?php get_template_part('loop', 'index'); ?>
    			</div>
    
    		</div><!-- End Content row -->
    
    		<?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    The add_theme_support snippet is in the after_setup_theme section.

    The end of my functions.php reads:

    function ppri_get_featured_posts() {
        return apply_filters( 'ppri_get_featured_posts', array() );
    }
    
    function ppri_has_featured_posts( $minimum = 1 ) {
        if ( is_paged() )
            return false;
    
        $minimum = absint( $minimum );
        $featured_posts = apply_filters( 'ppri_get_featured_posts', array() );
    
        if ( ! is_array( $featured_posts ) )
            return false;
    
        if ( $minimum > count( $featured_posts ) )
            return false;
    
        return true;
    }
    
    // In functions.php, in a function hooked to wp_enqueue_scripts
    if ( ppri_has_featured_posts( 1 ) ) {
        wp_enqueue_script( 'ppri-slider-script', get_stylesheet_directory_uri() . '/js/awesome-slider.js', array( 'jquery' ) );
    }

    I added a "featured" tag to the post and set "featured" as the tag name on the Settings > Reading panel.

    There's no front-page.php in Reverie, so I tried both adding code to index.php, page.php, and page-full.php.

    I tried creating a front-page.php based on the page.php.

    I tried putting the following in the loop files just before the start of the loop instead of within the pages.

    The page displays the standard page content with no featured post, throwing no errors. What am I doing wrong?

    http://wordpress.org/plugins/wp-featured-content/

Reply

You must log in to post.

About this Plugin

About this Topic