Tagged: x
-
AuthorPosts
-
December 17, 2016 at 2:02 pm #1296714
MiticaParticipantHello team,
I hope you can help me out, I have succesfully installed a code in _post-carousel.php to have both pages and posts appear in the carousel with the information already on the forum, so that is settled.
Now what I want to do is change the three lines of text that appear on hover, to the text in 3 custom fields in the posts and pages that I have featured in the post carousel. However, I have not found a code on the forum that makes this possible for both posts and pages, only for posts. Could you please help me to have the custom fields show on hover in the post carousel for both the pages and the posts I put in there? I would appreciate your help so much!
December 17, 2016 at 2:02 pm #1296718
MiticaParticipantMy url is test.tierramitica.com
December 17, 2016 at 9:05 pm #1296903
RadModeratorHi there,
Thanks for posting in.
What code have you added? You can use get_post_meta() to replace those lines, or with the help of ACF Pro plugin. May I know the implemented code and from what thread?
Thanks!
December 18, 2016 at 2:51 pm #1297346
MiticaParticipantHello Rad,
The code I added in my functions.php file so far is from the following thread:
´https://community.theme.co/forums/topic/help-getting-post-excerpt-in-ethos-post-carousel/#post-191661´if ( ! function_exists( 'x_ethos_entry_cover' ) ) : function x_ethos_entry_cover( $location ) { if ( $location == 'main-content' ) { ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <a class="entry-cover" href="<?php the_permalink(); ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>"> <h2 class="h-entry-cover"><span><?php x_the_alternate_title(); ?></span></h2> </a> </article> <?php } elseif ( $location == 'post-carousel' ) { ?> <?php GLOBAL $post_carousel_entry_id; ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <a class="entry-cover" href="<?php the_permalink(); ?>" style="<?php echo x_ethos_entry_cover_background_image_style(); ?>"> <h2 class="h-entry-cover"><span><?php ( $post_carousel_entry_id == get_the_ID() ) ? the_title() : x_the_alternate_title(); ?></span></h2> <div class="x-post-carousel-meta"> <span class="entry-cover-author"><?php echo get_the_author(); ?></span> <span class="entry-cover-categories"><?php echo x_ethos_post_categories(); ?></span> <span class="entry-cover-date"><?php echo get_the_date( 'F j, Y' ); ?></span> <span class="entry-cover-excerpt"><?php the_excerpt() ?></span> </div> </a> </article> <?php } } endif;On all the threads I find it says to modify the part
<span class=”entry-cover-author”><?php echo get_the_author(); ?></span>
<span class=”entry-cover-categories”><?php echo x_ethos_post_categories(); ?></span>
<span class=”entry-cover-date”><?php echo get_the_date( ‘F j, Y’ ); ?></span>
<span class=”entry-cover-excerpt”><?php the_excerpt() ?></span>But I am not that familiar with coding yet and it is not clear to me what exactly to modify and how, some help would be greatly appreciated.
For the page displaying in the carousel now, I added three custom fields with text as values:
date_workshop (value: February 4th to 13th, 2017), full_moon (value: Full moon February 10), info(For more info, click here).Now how do I put these fields into the code so that their values display in the carousel?
Sorry for these newbie questions again, but it is a jungle out there!
December 18, 2016 at 7:40 pm #1297584
Rue NelModeratorHello There,
I have logged in to your site and inspected the pages. I couldn’t find the custom fields as you have stated above. You will need to add a custom field so that you can display it with a code which would replace the information you need to display. To know more about custom fields and how you can display it in your site, please check out this codex:
https://codex.wordpress.org/Custom_FieldsHope this helps.
December 21, 2016 at 2:41 pm #1300902
MiticaParticipantHello Rue Nel,
I did create them before, but only for one of the carousel items, so maybe that is where things became confused… I made new custom fields now for the two posts and the one page that are now in the carousel, for ease I called them 1, 2 and 3, with custom values for each field for each individual post or page.
Now I am trying to figure out how to get them to display in the carousel, help with this would be very much appreciated because I am not managing with the little I know of coding.Thank you so much
December 21, 2016 at 7:43 pm #1301194
Rue NelModeratorHello There,
I have check your post and I found this custom meta fields:

If you want to display this, you can make use of this code:
<span class="entry-cover-meta"><?php echo get_post_meta( get_the_ID(), '1', true ); ?></span> <span class="entry-cover-meta"><?php echo get_post_meta( get_the_ID(), '2', true ); ?></span> <span class="entry-cover-meta"><?php echo get_post_meta( get_the_ID(), '3', true ); ?></span>As this is all custom development, regretfully we won’t be able to assist further. Custom development is outside the scope of our support. We’re happy to provide advice and get you started in the right direction, but you would still be responsible for the implementation.
Thank you for your understanding.
December 23, 2016 at 11:08 am #1302870
MiticaParticipantWorks like a charm 🙂 Thank you so much Rue Nel, I really appreciate it!
December 23, 2016 at 1:12 pm #1302982
JoaoModeratorGlad to hear it 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1296714 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
