Forum Replies Created
-
AuthorPosts
-
Janek
ParticipantOk, I’m really shitty now, cause I’ve wasted your time. I did the old disable all plugins except WP Show Posts and Advanced Custom Fields and it seems that the problem was the Codeit Glossary plugin which somehow is preventing the custom field from appearing. Makes no sense but there you go! I’ll work at fixing this issue by troubleshooting the Glossary plugin with their dev. There plugin is great in theory but it has so many quirks.
Janek
ParticipantHey Tom,
That only appears to display the page title below the content instead of the post title of the WPSP list. It also targets all WPSP lists.
I’d prefer to implement a custom field as shown above, this way I can ensure it only works on the WPSP that have posts that use the custom field. But as mentioned for some stupid reason it doesnt work with ‘wpsp_after_content’ but it does with ‘wpsp_before_content’.
Janek
ParticipantSo I found in one of my old support threads here that I can use wpsp_after_content as a filter so with the following I should be able to output a custom field after the content however I’m finding it doesnt want to work. Something to do with the filter since if I change it to wpsp_before_content it outputs the custom field above fine. Any thoughts?
add_action( 'wpsp_after_content', 'tu_add_custom_meta_testimonial' ); function tu_add_custom_meta_testimonial() { $meta = get_post_meta( get_the_ID(), 'testimonial_source', true ); if ( isset( $meta ) && '' !== $meta ) { echo '<div class="testimonial-source">' . $meta . '</div>'; } }
Janek
ParticipantAlternatively if I could get a list of the filters I can output a custom field after the entry-content myself.
Janek
ParticipantNo problem, Tom. Thanks for the update. I have a project I’m involved in that would certainly benefit from the carousel function. 🙂
I’ll keep my eyes peeled for the update in the future.
Janek
ParticipantI’ve had a browse, but didnt find anything. I’ll take a better look and maybe post up something there.
Thanks for your help as always, its appreciated! 🙂
Janek
ParticipantSorry for the late reply.
Yes I believe these are the correct ID’s. I’ve just doubled checked them and there is a sub field called link, however the target and title is provided by setting the field type to Link. The input on a post using the custom field would show WordPresses’s standard hyperlink window which in turn would provide data for the link, target and title fields.
I took a screenshot of the custom field post input options here:
https://drive.google.com/open?id=1SAuM1qX5XY-pw0DggNS7Ay27sCsVkMpnAs well as a screenshot of the custom field setup in the ACF plugin here:
https://drive.google.com/open?id=1QT_jpgeBvQIrTaPgBMC7BqfF8zlSzcYtPerhaps that provides a better idea than my description?
If nothing jumps out at you, it might be time to try a different approach rather than using the repeater field I’ll try to get this working with a single entry.
Janek
ParticipantInterestingly it doesn’t output anything on the front end. I looked over the code and nothing seems to be out of order. Any thoughts? 🙁
Janek
ParticipantAwesome, that seems to work perfectly. Thanks.
Although do you know why the other Show Posts container wasnt having the no-results class applied to it?
Seems quite odd.
Janek
ParticipantHoly shit, it works! Your a legend! Thanks for the help! I think I’m slowly grasping the basics of PHP… but don’t think youve seen the last of me! 🙁
I used the following for anyone who might come after me:
add_action( 'wpsp_after_title', 'tu_add_advertising_images' ); function tu_add_advertising_images() { if ( function_exists( 'get_field' ) ) { $image = get_field('advertisement_desktop'); $mobile_image = get_field('advertisement_mobile'); if ( ! empty( $image ) ): ?> <div class="desktop-image"> <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> </div> <div class="mobile-image"> <img src="<?php echo $mobile_image['url']; ?>" alt="<?php echo $mobile_image['alt']; ?>" /> </div> <?php endif; } }
Janek
ParticipantHey Tom,
Sorry to drag this one back out, but I’m having an issue with this. I have a second WP Show Posts list that should hide when empty but it doesnt. This is due to the fact that it doesnt apply a .wpsp-no-results class when empty.
I’m completely at a loss why it wouldnt apply that class to itself like the other one on the page, I’ve tried to recreate it with a new list as well, and same thing happens.
To view the section with the list in it you can access my staging site:
http://staging.janek-dev.flywheelsites.com/Username to view the site is collaborator… and surely you know what the password is by now. 😉
I’ve been doing tests here to no avail. If you access the page source and search for .wpsp-no-results you can see that it only appears once and thats in the #upcoming-airshows div section which has hidden automatically with the code you supplied earlier. The other one that should hide is the #next-episode div, but its not it just sits there and wont add the no results class to itself even though its empty.
I still need to reply to your other posts on here, and I apologise for not getting to them sooner. The site proper launched last night and leading up to it I’ve been doing last minute bug fixes. Obviously I didnt catch them all. 😛
Janek
ParticipantNo worries, Tom. I’m happy to just shelve this one for the moment. I’ve spoken to the client and asked if we can forgo that functionality and they are ok with it.
Thanks for looking to this for me.
Janek
ParticipantThe site url has changed to:
http://staging.janek-dev.flywheelsites.com/wp-adminI’ve been moving things around in order to be ready to deploy the site in 2 days.
Janek
Participant:'(
As much as I love Ajax pagination, I’ll just have to let this one go I guess.
Thanks for checking though!
Janek
ParticipantAwesome, that worked! Thank you!
Just one or two more questions and I swear I’ll be done with this.
If I had more than one image field how would I go about inserting that?
For instance at the moment I have:
$image = get_field('advertisement_desktop');
But I also have this field that I want to include
$image = get_field('advertisement_mobile');
I also need a way to display one or the other depending on breakpoint. Which I was going to do with CSS. Is there a simple way to output these in separate divs classes?
-
AuthorPosts