Informations
-
Hey…
Someone can tell me how I can include post’s information (date, author, tags) on slider? I did it, but the same information repeats on all posts.
(shy)
https://www.ads-software.com/plugins/featured-articles-lite/
-
You can use the plugin’s template functions into slider theme display.php file. For example, author can be displayed into the slides loop by using function the_fa_author() and date by using function the_fa_date().
You can always check FA docs section for any information. If you think something is missing, just let us know.
Thank you again, CodeFlavors!
Very nice article, will be very useful for me.
I also want use another function php the_subtitle(); for add subtitles on my slider posts. But the subtitle of first article repeats on all articles. Any way to fix it?
THANKS!Happy to be of help. I assume you stored the subtitle into custom fields for each post.
In order to get the current slide object into the slides loop (which is actually a modified post object), you can use function get_current_slide().
For example, in file display.php:
// ...HTML/PHP code while( have_slides() ){ $slide_obj = get_current_slide(); $my_meta = get_post_meta( $slide_obj->ID, 'your_custom_field', true ); // rest of slide code here... } // ...other display code
In fact, subtitle is a plugin that I want to use. : /
I don’t know to do that… ??
If you’re using this plugin for subtitles, you could retrieve subtitles with get_the_subtitle() like this:
// ...HTML/PHP code while( have_slides() ){ $slide_obj = get_current_slide(); // get subtitle, display it with echo into slider template $subtitle = get_the_subtitle( $slide_obj->ID, '', '', false ); // rest of slide code here... } // ...other display code
Usage of get_the_subtitle() is described on the plugin page.
Hey CodeFlavorsI tried to do how you said, but when I try, my layout stops (no load). I really tried several ways, but I do not understand codification, so, It’s hard for me. So I am giving up…
Thank you so much for your kindness anyway!
Don’t give up ?? Using the plugin I mentioned above, here’s the complete implementation ( this is complete display.php file )
<?php // get the options implemented by the slider theme $options = get_slider_theme_options(); ?> <div class="<?php the_slider_class( 'fa_slider_simple' );?>" style="<?php the_slider_styles();?>" id="<?php the_slider_id();?>" <?php the_slider_data();?>> <?php while( have_slides() ): ?> <?php // get the subtitle (requires plugin that can be found here: https://www.ads-software.com/plugins/wp-subtitle/ ) $slide_obj = get_current_slide(); $subtitle = ''; if( function_exists( 'get_the_subtitle' ) ){ $subtitle = get_the_subtitle( $slide_obj, '<h3 class="fa-subtitle">', '</h3>', false ); } ?> <div class="fa_slide <?php the_fa_class();?>" style="<?php the_slide_styles();?>"> <div class="fa_slide_content"> <?php the_fa_title('<h2>', '</h2>');?> <?php // output the subtitle echo $subtitle; ?> <?php the_fa_content('<div class="description">', '</div>');?> <?php the_fa_read_more('fa_read_more');?> <?php the_fa_play_video('fa_play_video', 'modal');?> </div> <?php the_fa_image( '<div class="fa_image">', '</div>', false );?> </div> <?php endwhile;// have_slides()?> <?php if( has_sideways_nav() ):?> <div class="go-forward"></div> <div class="go-back"></div> <?php endif;?> <?php if( has_bottom_nav() ):?> <div class="main-nav"> <?php while( have_slides() ):?> <a href="#" title="" class="fa-nav"></a> <?php endwhile;?> </div> <?php endif;?> <?php // show progress bar according to user settings if( isset( $options['show_timer'] ) && $options['show_timer'] ): ?> <div class="progress-bar"><!-- slider progress bar --></div> <?php endif;// show timer?> </div>
The subtitle will be wrapped in h3.fa-subtitle in this example but you can change the class if you want.
Code above should be put into file display.php of theme Simple (I assume you already moved the theme outside the plugin’s folder, if not, follow this tutorial before making any changes).
OH MY GOD! It works!
CodeFlavors, I haven’t words for thank you again and again. You’re awesome, the code works perfectly, thanks thankssss! ??
\o/ yay
My pleasure, enjoy ?? I would really love to see where you’re using this if possible (it’s OK if you want to keep your project private).
Please don’t forget to mark the request as resolved if there isn’t anything else I can help you with, thank you.Ofc, I can show it for you, when the site come online (I keep it private for while). I’ll publish it on next days, so, sure I’ll come back here to give you the final url.
Thank you one time more, I could not do it without your precious help!
??
- The topic ‘Informations’ is closed to new replies.