Support » Theme: Twenty Fourteen » Changing featured content from posts to pages

  • Resolved craigomatic

    (@craigomatic)


    Hi all,

    Loving this theme and am in the midst of customising to suit my needs.

    I’d like to have my frontpage display featured pages instead of featured posts.

    To this end I’ve done the following in my twentyfourteen child theme:

    1. Defined Featured_Content in functions.php so that I can redirect it to my featured-content.php in the child theme

    define('Featured_Content', true);
    
    require '/inc/featured-content.php';

    2. Modified the function get_featured_post_ids() to return pages that match a meta_key:

    // Query for featured pages.
    		$featured = get_pages( array(
    			'sort_column' => 'ID',
    			'number' => $settings['quantity'],
    			'meta_key'   => 'featured-page',
    			'meta_value' => '1',
    			'post_type'	   => 'page')
    		);

    3. Verified my featured pages are being found

    print_r($featured);

    After this point I seem to be getting stuck, it looks like content-featured-post.php is the template used, however I dont seem to be able to get any debug output or the grid output I’d love to see by modifying this file.

    Can anyone help to point me in the right direction?

    Thanks!
    Craig

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter craigomatic

    (@craigomatic)

    I ended up working this out…

    I needed to change get_featured_posts in featured-content.php to query using get_pages.

    After I did this, the featured-pages appeared as expected and required a little fine-tuning in content-featured-post.php to display they way I wanted them to.

    Hey! glad to see someone who has found a fix.

    I needed to change get_featured_posts in featured-content.php to query using get_pages.

    As I do not have a working knowledge of CSS I would appreciate if you could post the whole code that has to be changed to achieve this.

    Thanks.

    This is a change I’ve been attempting to make, I have a lot to learn so I’m asking to help a brotha out. I have two quick questions in order to accomplish flushing this out,
    1. recieved: Fatal error: Cannot redeclare class Featured_Content in “” after adding

    define('Featured_Content', true);
    
    require 'path-name/inc/featured-content.php';

    to functions. Not sure of the proper way to resolve this with a child theme.

    2. Would you be so kind to post your example of querying get_pages?

    If you require assistance then, as per the Forum Welcome, please post your own topic.

    This topic references an old version of WordPress.

    Is there a solution for “featuring” pages and also posts?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing featured content from posts to pages’ is closed to new replies.