I am new to wordpress. Basically implemented a slider which works perfectly. Now Main thing is that I want the images that I used to be uploaded by admin user . I don't have idea to achieve this. Please help me. Amy help is heartly appreciated.
Here is my code :-
<aside class="portfolio-right">
<ul class="mybxslider">
<li><img src="<?php bloginfo('template_url'); ?>/images/acc-thumbnail-1.jpg" /></li>
<li><img src="<?php bloginfo('template_url'); ?>/images/acc-thumbnail-2.jpg" /></li>
<li><img src="<?php bloginfo('template_url'); ?>/images/acc-thumbnail-3.jpg" /></li>
</ul>
<script>
$('.mybxslider').bxSlider({
adaptiveHeight: true,
mode: 'fade'
});
</script>
</aside>
Create custom post type Slider Images
& add slider image as feature image in that post type..
for display that images in slider use
<ul class="mybxslider">
<?php
$args = array(
'post_type' => 'slider_post', //Post type
'posts_per_page' => 10
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
?>
<li><img src="<?=$url?>" width="350" height="350" /></li>
<?php } } ?>
</ul>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.