• bkbarton

    (@bkbarton)


    I must be missing something…

    Is there a way to…

    • have a page template
    • that has a ‘custom’ text input area in admin
    • that then passes this ‘custom’ text to the associated page sidebar
    • …meaning, this ‘custom’ text will not be visible anywhere else, but the specific associated page it was meant to accompany

    In my research, I have ways of adding custom meta data or links or images or to the sidebar of a page… but no way of adding associated content that matches that of the main post. The WordPress community has to have come up with someway of including this content. It is a content management system, right?

    Please show me what I’m missing…

    Thanks.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Not exactly. WP is a blogging platform that morphed into an ersatz CMS. It was not designed as such from the beginning. IMO this makes WP both disturbing and incredible at the same time 🙂

    Normally sidebars cannot know what post is being displayed because the sidebar is outside of the “Loop”. However, the last post of the loop, or the only post in the case of single pages, should remain available in the global $post object as long as no script has reset the query for some purpose.

    If so, you sidebar template should still be able to get associated post meta and display it. You cannot rely on this universally, but it might work for your specific site. You could do a simple test by having the sidebar template output the global $post->post_title and confirm it’s matching up with the current post. If it does, getting associated post meta isn’t much more complicated.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding custom input and linking to page sidebar’ is closed to new replies.