- This topic has 48 replies, 4 voices, and was last updated 3 years, 4 months ago by Tom.
-
AuthorPosts
-
November 24, 2020 at 1:40 pm #1545117diedrich
Thanks Leo
just for clarity where do I paste this?November 25, 2020 at 2:59 am #1545825DavidStaffCustomer SupportHi 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 toEntire Site
November 25, 2020 at 3:18 am #1545850diedrichThank you David
No CSS code ?
November 25, 2020 at 3:40 am #1545875DavidStaffCustomer SupportIf 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.
November 25, 2020 at 4:03 am #1545911diedrichoeiiiiii . I did it …….., but I see nothing . also clear my cache WP-rOCKET
WHAT DO i WRONG ?
Greeting Diedrich
November 25, 2020 at 7:55 am #1546523DavidStaffCustomer SupportI am not seeing the code in the site.
Can you provide screenshots of the Hook Element and its display rules ?November 25, 2020 at 8:03 am #1546535diedrichHi David
where can I drop the photos?
November 25, 2020 at 8:10 am #1546548diedrichNovember 25, 2020 at 10:04 am #1546825LeoStaffCustomer SupportCan you check the execute PHP?
https://www.screencast.com/t/KlCV9KiINovember 25, 2020 at 10:30 am #1546885diedrichhello, 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 diedrichNovember 26, 2020 at 5:04 am #1549422DavidStaffCustomer SupportTry 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 } ?>
November 26, 2020 at 5:22 am #1549459diedrichHi 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
November 26, 2020 at 8:36 am #1550071DavidStaffCustomer SupportYou 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.
November 26, 2020 at 9:16 am #1550168diedrichyou 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
DiedrichNovember 26, 2020 at 1:05 pm #1550600TomLead DeveloperLead DeveloperLooking 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.
-
AuthorPosts
- You must be logged in to reply to this topic.