[Resolved] right above the sitebar 2 images made with NEXT and PREVIOUS

Home Forums Support [Resolved] right above the sitebar 2 images made with NEXT and PREVIOUS

Home Forums Support right above the sitebar 2 images made with NEXT and PREVIOUS

Viewing 15 posts - 16 through 30 (of 49 total)
  • Author
    Posts
  • #1545117
    diedrich

    Thanks Leo
    just for clarity where do I paste this?

    #1545825
    David
    Staff
    Customer Support

    Hi there,

    create a new Hook Element:

    https://docs.generatepress.com/article/hooks-element-overview/

    Add this code to the hook text field:

    <?php
    if ( is_attachment() ) {?>
        <div class="attach-navigation">
            <span class="prev"><?php previous_image_link( 'thumbnail' );?></span>
            <span class="next"><?php next_image_link( 'thumbnail' );?></span>
        </div>
    <?php
    }
    ?>

    Check execute PHP.
    Select the Hook: generate_before_right_sidebar_content
    Set the Display Rules to Entire Site

    #1545850
    diedrich

    Thank you David

    No CSS code ?

    #1545875
    David
    Staff
    Customer Support

    If you can add the Hook then so i can see its outputting the next / previous images then ill take a look at the CSS required.

    #1545911
    diedrich

    oeiiiiii . I did it …….., but I see nothing . also clear my cache WP-rOCKET

    WHAT DO i WRONG ?

    Greeting Diedrich

    #1546523
    David
    Staff
    Customer Support

    I am not seeing the code in the site.
    Can you provide screenshots of the Hook Element and its display rules ?

    #1546535
    diedrich

    Hi David

    where can I drop the photos?

    #1546548
    diedrich

    https://we.tl/t-NJlQjC0yj2

    screenshots

    greeting Diedrich

    #1546825
    Leo
    Staff
    Customer Support

    Can you check the execute PHP?
    https://www.screencast.com/t/KlCV9KiI

    #1546885
    diedrich

    hello, the beginning is there ……. πŸ™‚ πŸ™‚ πŸ™‚ , I see 2 images on my attachemd page:

    but the following is not yet correct:

    1: he now randomly takes an image somewhere, he has to take the correct image, namely from an attachemd page the order of the attachement page

    2: otherwise the text NEXT and PREVIOUS is missing

    3: and the 2 images should remain fixed when scrolling

    can you help me?
    greeting diedrich

    #1549422
    David
    Staff
    Customer Support

    Try changing the PHP code to this:

    <?php
    if ( is_attachment() ) {?>
        <div class="attach-navigation">
            <span class="prev"><?php adjacent_image_link( false, 'thumbnail', 'Previous Link' );?></span>
            <span class="next"><?php adjacent_image_link( true, 'thumbnail', 'Next Link' );?></span>
        </div>
    <?php
    }
    ?>
    #1549459
    diedrich

    Hi David, sorry this is no good
    >>>>> I don’t see any more pictures

    >>>>> text on the image is also incorrect

    >>>>> next is previous

    >>>>> previous is next

    >>>>>> which is very important: there is no order, so for example “next” it will not show the first next

    cache is empty

    #1550071
    David
    Staff
    Customer Support

    You can put back the old code, below i have included that code with the Previous Link and Next Link labels. You can change the labels to whatever you want:

    <?php
    if ( is_attachment() ) {?>
        <div class="attach-navigation">
            <span class="prev"><?php previous_image_link( 'thumbnail', 'Previous Link'  );?></span>
            <span class="next"><?php next_image_link( 'thumbnail', 'Next Link'  );?></span>
        </div>
    <?php
    }
    ?>

    But there is no way to change the order of them, they will simply display whatever attachment was registered before that one or after that one. Theres no control over that.

    #1550168
    diedrich

    you say you can’t set the order of next and previous? you can’t do anything with the data that is mentioned everywhere?

    i still don’t see the image either

    I have clear my cache

    Greeting
    Diedrich

    #1550600
    Tom
    Lead Developer
    Lead Developer

    Looking at the functions, it seems like you can choose text OR the image.. If you remove the text from those functions, the images should appear. Not sure what their thinking was behind this.. it may be possible to re-add the text using CSS, as adding the image in with the text would be much more complex.

    The order itself is defined by WP as it’s a core function.

Viewing 15 posts - 16 through 30 (of 49 total)
  • You must be logged in to reply to this topic.