• Resolved eckul

    (@eckul)


    Hi, I am wanting to create a check box that appears in admin when creating/editing a page or post. When checked I want elements of this page to appear on the home page. If more than one post/page has the box checked I want it only to display the post/page with the most recent tick. I am just looking for a starting point are ther any plugins around that have this capability? Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • Tim Nash

    (@tnash)

    Spam hunter

    If you don’t mind getting your hands a little dirty, then you could do this in a variety ways.

    The simplest way is to use a plugin like Advanced Custom Fields (which is free though there is a pro version), to add your metabox, then you would need to modify your theme homepage loop to show only posts with a specific metadata.

    This is where it will get little vague as depending on your theme this might be as simple as

    'meta_query' => array(
    	array (
    		'key' => 'your_meta_key',
    		'value' => '1',
    		'compare' => '=='
    		)
    	)

    into your loop query, or it might be more complicated if your theme already does lot’s of custom work.

    There are other options such as using Flexible Post Widget which creates a widget, allowing you lots of control and then displaying that widget on your home page.

    Hopefully that get’s you in the right direction, if you go down the ACF route, they have some pretty good documentation, and dedicated support forum, where people have asked similar things, specific to their theme and people have been able to go into specifics.

    Thread Starter eckul

    (@eckul)

    Thanks Tim, that’s great. I am starting with Advanced custom fields. Hopefully I’ll be able to sort it out. Cheers

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Include elements for post/pages on home page’ is closed to new replies.