Forums

Different ways to display post on single page template? (5 posts)

  1. alexemde
    Member
    Posted 3 years ago #

    Hi,

    I am looking for a way to add an additional single post template that would allow to display a differently styled page when a certain link is clicked. Not sure if this is at all possible?

    In a little more detail: I use the normal template structure with home / category and single templates, but I want to add a link below my post text that would open up a popup window and display my post (which is an image gallery) in a completely different style.

    Category specific templates or even post-id based templates don't help me out, because I only want to use the extra template when the post is called through an extra link.

    Any ideas, anyone?

  2. doppelboxx
    Member
    Posted 3 years ago #

    Hi,
    you might solve your problem by adding a parameter to your link-URL like "&special=true" which then can be checked in the single-template.

    get my drift?

  3. t31os
    Member
    Posted 3 years ago #

    So you're suggesting using GET?

    <?php if(isset($_GET['special'])) {
    if($_GET['special'] == 'true or whatever else') { ?>
    
    If GET special is equal to the above, do whatever is here
    
    <?php } else { ?>
    
    If if GET special is set but set to something else do whatever is here..
    
    <?php }} ?>

    That would work....

    However, WP has lots of pre-built functions for handling pages, posts, categories and more...

    I think you should be looking at either page templates or using post categories with some custom IF cat = 'my cat', then do something, where something is your particular code...

    Lots of options...

  4. alexemde
    Member
    Posted 3 years ago #

    I think the first suggestion could work better for my purpose, because as explained, single posts need to be styled different depending on context, so categories and tags and such probably wouldn't help, because they belong to the post and don't change when I want the template to change. Thanks anyway, I'll give it a try and report back :-)

  5. MichaelH
    Volunteer
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.