Support

Account

Forum Replies Created

  • sorry i used archive-custom.php just as an example, it was archive-case-study.php. I’ve ended up just creating a custom loop on a custom page template which fullfills my needs until i learn more about archive pages. many thanks for the help

  • Hi John,

    Thanks for response. Apologies if not explained myself clearly, i’m confusing myself,! I think i need to learn more about basic template hierarchy foremost. B

    Basically i want to pick the page that loops through the casestudies. Currently that page is a archive-custom.php file and works ok. But i think i might need to create a custom page template that loops through that archive page instead.

  • Ah ok so i worked out it easy to do with page link but then i havent got the same capabilities of the post object field. Does anyone know how to do it with the post object?

  • Thanks petercarsater,

    This is just what i needed!

    The code you have shown is all a bit advanced for me, trying to understand it. I kind of want to be a bit freestyle in what i hide and don’t hide so i bodged your code to echo the page-id to the admin’s body class so i can be really detailed with what pages see what:

     if ($post->post_type == "page") : // set 'page' for page postypes
                        echo 'var $template_name = "page";';
                    else :
                        // Just get the template name
                        echo 'var $template_name = $("#page_template").val();';
                    endif;
    
                    ?>
    
                    // Add classes to body
                    window.UpdateACFView = function($template_name) {
    
                        if ($template_name == "page") {
                            $('body').addClass('<?php global $post; echo "pageid-".$post->ID; ?>');
                        }

    Can you let me know if this is the best practice to achieve this? Seems to work though.

Viewing 5 posts - 1 through 5 (of 5 total)