Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter skaufmann

    (@skaufmann)

    Also to get the gallery category template running, I used the following code:
    https://php.pastebin.com/m59ac961e

    Thread Starter skaufmann

    (@skaufmann)

    I tackled one of my improvements

    -Add View Post and View Gallery links to the post.

    For every post I add the Photo Gallery category to, not only does it add it to the photo gallery page, it also adds a “View Gallery” icon in the upper-right of the post. When you are viewing a post’s gallery, there is a “View Post” icon in the upper-right.

    See this post for the example:
    https://www.karieandscott.com/blog/the-running-of-the-crazy-people-oh-yeah-and-bulls

    Here is what I did it:
    Modified single.php and index.php with the following:

    I moved $att = $_GET["att"]; (see first post above in this thread) from the loop and put it before the loop since I was calling this variable more than once. I now have <?php $att = $_GET["att"];?> just before the loop starts. This allows me to use the URL variable at any time to filter my post view.

    To add the buttons, I first created the buttons then added the following code just after the Title in the loop:

    <?php if ( in_category(52) ){
        echo '<a href="';
        echo the_permalink();
        if ($att=="yes")
            echo '"><img class="viewphotos" src="https://www.karieandscott.com/blog/wp-content/themes/blossom/images/viewpost.gif"></a>';
        else
            echo '?att=yes"><img class="viewphotos" src="https://www.karieandscott.com/blog/wp-content/themes/blossom/images/viewphotos.gif"></a>';
    }?>

    The if (in_category(52) code looks to see if the post being compiled by the loop is in the Photo Gallery category, if it is then it looks for the $att variable in the URL. If it is yes then it means the current view is the Gallery view and the “View Post” button should be display. If $att is not yes then the view is the Post view then the “View Gallery” button is displayed and the link has ?att=yes added so the view will be filtered to the gallery when clicked on. I updated my CSS to help place the icon where I want it.

    I also added <?php if ($att=="yes") echo 'Gallery: ';?> just before the title so if the gallery is viewed, the title has “Gallery: ” added to the title.

    Skaufman, do you the ordinary code for the gallery category feature used by matt?

    Thread Starter skaufmann

    (@skaufmann)

    No I used a modified version of the code I posted a link to in my second post above. The photo album feature is not built into WP. I suspect there will be some version of it in the future but this works well for now.

    I knew i saw that code before, thats my code, i am photoneil as you can probz see from my site. I am having problems using it within my new theme, maybe you can help?

    Thread Starter skaufmann

    (@skaufmann)

    You’re site isn’t loading so I can’t see what is wrong. Just curious though, if it’s your code, shouldn’t you be able to figure it out? Not that I won’t try to help…

    Digg effect, damm you digg ?? I did try and add the code that i used in the old theme but got the “white screen of death” I think there is one small bit missing or in the wrong place, thats why im asking for your big php brain to help.

    my current index is here, maybe if you could please take the code and place it in the new one where you think it should work, that would be a great help!

    Cheers mate!!

    Thread Starter skaufmann

    (@skaufmann)

    I might have had the same problem. Start a new thread and post a link to it here. I think it would be appropriate as it’s a different problem. I’ll post my category template there too.

    Thread Starter skaufmann

    (@skaufmann)

    I also just added the following code to the Title in my header.php so that the title of the post when viewing the gallery filter, has “Gallery: ” added to it.

    if (is_front_page()){
        echo 'KarieandScott.com - A blog of our European Adventure';
    }else{
        $att = $_GET["att"];
        if ($att=="yes") echo 'Gallery: ';
        wp_title('');
        echo ' | ';
        bloginfo('name');
    }

    Hello and thanks for the useful post!

    I am trying to follow your instructions to my site but the gallery template code you paste has expired and i am stuck. Could you please re-post it?

    Thank you!

    I dont use this code on my index.php but i do use it on the archives.php, which is pretty much exactly the same, so ive posted my archives here, maybe that helps you guys? let me know ??

    Guys, I posted a similar approach about a month ago in case you are still looking for a Ma.tt like gallery tutorial
    https://blackbox-tech.com/blog/wordpress-gallery-tutorial-as-seen-on-matt/

    Hi, can I add and remove images from the native images-gallery in a post?

    I can’t found how add an existent image (from just existent images in media) to the images-gallery into the editing post.

    Also I unknown how can I remove an image from gallery.

    Thank you!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Display posts and gallery of post attachments seperately’ is closed to new replies.