Hi @risajmiller,
I hope you are well today and thank you for your question.
You can achieve this by using the solution posted in the following reply.
https://colorlib.com/wp/forums/topic/slider-for-pages/#post-33351
Best Regards,
Movin
Awesome, thank you!!! Can I just add that code to the existing functions.php file? Or how do I connect it? Thanks again.
Hi @risajmiller,
Thank you for your reply.
You can just use the attached child theme from the shared topic or if you are already using the child theme then just add the following code in the functions.php file of your child theme.
/**
* Featured image slider, displayed on front page for static page and blog
*/
function sparkling_featured_slider() {
if ( is_front_page() && of_get_option( 'sparkling_slider_checkbox' ) == 1 ) {
echo '<div class="flexslider">';
echo '<ul class="slides">';
$count = of_get_option( 'sparkling_slide_number' );
// $slidecat =of_get_option( 'sparkling_slide_categories' );
$query = new WP_Query( array( 'posts_per_page' =>$count, 'post_type' => 'page', 'meta_key' => 'slider_page' ) );
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
echo '<li><a href="'. get_permalink() .'">';
if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
echo get_the_post_thumbnail();
endif;
echo '<div class="flex-caption">';
if ( get_the_title() != '' ) echo '<h2 class="entry-title">'. get_the_title().'</h2>';
if ( get_the_excerpt() != '' ) echo '<div class="excerpt">' . get_the_excerpt() .'</div>';
echo '</div>';
echo '</a></li>';
endwhile;
endif;
echo '</ul>';
echo ' </div>';
}
}
After using the code, just create a custom field slider_page for the page as described on the shared thread.
Best Regards,
Movin
You are most welcome here 🙂
I’m not sure how to make this work. I installed and activated the child theme, then added the code above to functions.php on the child theme… and all I got was a fatal error.
How should I proceed?
Thank you!
@filo21 This topic is marked as resolved and to help us keep support thread separates could you please create your own thread for your question here https://colorlib.com/wp/forums/forum/sparkling/ instead of replying on others thread as it makes the thread messy and hard to read.
If you want to you can also add reference of this thread in your newly created thread.
We would be more than happy to help you on your new thread.