Support » Theme: evolve » Conditional Tags, Category, slider.

  • Resolved wolfneo

    (@noaneo)


    Hi,
    https://sculpteurstrill.com/presses/
    For a friend’s site.
    With version 3.8.4 of Evolve, in a child theme, I put the file archives.php and I added this code
    <?php if (is_category('presses')) echo do_shortcode("[metaslider id=3945]"); ?>
    To put a slider on the category “Presses” only.

    With the update, locally, I took the new file archives.php
    I put this code
    if (is_category('presses')) echo do_shortcode("[metaslider id=3945]");
    or
    if (is_category('presses')) {echo do_shortcode("[metaslider id=3945]"); }

    But this appears on the whole site and not only in the Presses category.
    how to do ?
    Thank you

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Theme Author Romik84

    (@romik84)

    hello,

    where exactly do you insert the code? I tried simple code:

    if (is_category('1')) { echo "test"; }

    with the cateory ID and it works just fine. But of course, you can use a custom hook, if you don’t wanna modify the file directly 😉

    Hi,

    in archive.php, between the lines 24 and 42

    	/*
    		Before Post Title
    
    		---------------------------------------
    		Hooked: evolve_breadcrumbs() - 10
    				evolve_archive_page_title() - 20
    		--------------------------------------- */
    
    	do_action( 'evolve_before_post_title' );
    
    if (is_archive('presses')) {echo do_shortcode("[metaslider id=3945]");}
    
    	/*
    		Before Archive Loop
    
    		---------------------------------------
    		Hooked: evolve_pagination_before() - 10
    				evolve_posts_loop_open() - 20
    		--------------------------------------- */

    Thank you

    Theme Author Romik84

    (@romik84)

    use instead:

    if (is_category('presses')) { echo do_shortcode("[metaslider id=3945]"); }

    First I tried category, and saw the problem, I just try archive, but the same.

    	/*
    		Before Post Title
    
    		---------------------------------------
    		Hooked: evolve_breadcrumbs() - 10
    				evolve_archive_page_title() - 20
    		--------------------------------------- */
    
    	do_action( 'evolve_before_post_title' );
    
    if (is_category('presses')) {echo do_shortcode("[metaslider id=3945]");}
    
    	/*
    		Before Archive Loop
    
    		---------------------------------------
    		Hooked: evolve_pagination_before() - 10
    				evolve_posts_loop_open() - 20
    	

    This is the result
    https://zupimages.net/up/18/45/8ufx.jpg

    I will try tomorrow, directly on the site, with the plugin metaslider.
    Thank you

    Theme Author Romik84

    (@romik84)

    is_archive() function checks if you are on an archive page, it doesn’t recognize the defined ID. try insert the condition right before this:

    if ( have_posts() ) :

    Hi,
    Thank you, without changing anything, online everything works, thank you.
    https://sculpteurstrill.com/presses/

    Theme Author Romik84

    (@romik84)

    thanks for the update 😉

    Thank you for your answers, glad to have managed to update

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.