WordPress.org

Support

Support » Themes and Templates » [Resolved] Customs Fields syntax in Page of Posts template

[Resolved] Customs Fields syntax in Page of Posts template

  • JulianRichards
    Member

    @julianrichards

    I want my site to have two blogs, and it seems that the most efficient way of doing this will be to use Custom Fields to assign each post to one of the two blogs. So I’ve set up a Custom Field with the key ‘type’ and the values of either ‘blog’ or ‘work’. Now I want to make page templates to display the posts assigned each of these two values, as suggested at “Example Using Custom Fields“. I can’t work out which bits of the example code given at that link I need to replace with my own key and value names, though. Maybe I’m being dim, but could someone let me know?

    While I’m here: do I need all the code on that page? it seems there’s a lot more than is in the standard page.php file in the TwentyTwelve theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi
    Forum Moderator

    @esmi

    Try changing:

    $args = array(
    	// Change these category SLUGS to suit your use.
    	'category_name' => 'antiquarianism, championship',
    	'paged' => $paged
      );

    to:

    $args = array(
    	'meta_key' => 'type',
            'meta_value' => 'blog'
    	'paged' => $paged
      );
    JulianRichards
    Member

    @julianrichards

    Didn’t work, I’m afraid. The code you quote and tweak is from the “Page of Posts” template at http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates, though, not the “Page Of Posts with Custom Fields” version.

    Maybe the answer to my design desire is to have two separate “sites” running under the same domain, with one blog in each, and use a hard-coded header so that the site title and nav look the same everywhere.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Customs Fields syntax in Page of Posts template’ is closed to new replies.