Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1301991

    Hi, Enfolders

    I would like to remove div class [div class=’page-summary’/> from a pagination pages. If visitors on /page/2/ the desire div class should be removed. It should be done with php not not with css.

    Example: check below example
    screenshot: https://prnt.sc/13cezf0
    pagination: https://copybloggerthemes.com/blogger-templates/responsive/page/2/

    To give an idea something code like should be in function.php

    $paged = $wp_query->get( 'paged' );
    
    if ( $paged < 2 )  {
    // do nothing 
    return;
    }
     else {
    // remove div 'page-summary' from /page/2/ and /page/3/ so on
    remove'<div class='page-summary'/>;
    }

    I am using Enfold since 2015, it is a great theme and support team always helped me a lot.
    waiting to see the response soon.

    #1302364

    Hey Hafeez Ullah,

    Thank you for the inquiry.

    Those container are not generated by the theme, or do not exist in any of the theme template files. Did you create a custom template file? We can remove the container with a simple script if you like.

    Something like this.

    
    var summary = document.querySelector(".page-summary");
    summary.remove();
    

    You can use the wp_footer hook to append it to the page or to the document, or use the wp_add_inline_script function.

    // https://developer.wordpress.org/reference/functions/wp_add_inline_script/

    Best regards,
    Ismael

    #1302474

    @Ismael

    Yes, i am using the <class=’page-summary’/> as the custom tag inside the pages.
    Your code work but it remove the class from every page, while i want to apply certain condition that the code should only remove the <class=’page-summary’/> from /page/2/ pagination and so on. Like i have given example above.

    I hope you will help me there. Thanks bundles

    #1303058

    Hi,

    while i want to apply certain condition that the code should only

    Sorry for the delay. Try to check if the body tag contains a certain class name. Example.

    var body = document.querySelector("body");
    // check if the body tag has the class name page-id-321 or if the current page has the ID 321
    var is_page_321 = body.classlist.contains("page-id-321"); 
    
    if(is_page_321) {
       // do something here
       // like removing the page-summary container
    }

    Best regards,
    Ismael

    #1321550

    Hi, I’m after a similar solution. I only want to display the header in the 1st page of the pagination of a blog, and remove it in the following pages.

    I can’t find a way to remove it. Should I go through CSS or functions.php?

    Many thanks! :)

    #1321579

    Hi,


    @Steve
    : We have to inspect the page in order to check the issue. Please post the site URL in the private field and provide a screenshot of the “header” or element that you want to adjust.

    Best regards,
    Ismael

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