Open ghost opened 12 years ago
Please let me know how this goes for you. I'm looking to do the same thing
@dannymichel
This works completely fine without any issue for me. However for caption I had to modified this code a bit.
Ok, the caption works fine for me too, but I'm having a hard time trying to figure out how to add a link to the image and how to add the title as well. Any help would be appreciated
function slides_register() {
$labels = array(
'name' => _x('Slideshow', 'post type general name'),
'singular_name' => _x('Slide', 'post type singular name'),
'add_new' => _x('Add New', 'slide'),
'add_new_item' => __('Add New Slide'),
'edit_item' => __('Edit Slide'),
'new_item' => __('New Slide'),
'all_items' => __('All Slides'),
'view_item' => __('View Slide'),
'search_items' => __('Search Slides'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'Slides'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'menu_position' => 7,
'rewrite' => array(
'slug' => 'slideshow-item',
'with_front' => false,
'feed' => true,
'pages' => true ),
'supports' => array('title','editor','thumbnail', 'excerpt')
);
register_post_type( 'slides' , $args );
}
add_action('init', 'slides_register');
<?php wp_reset_query(); ?>
Check this slider http://pixelngrain.com. I have used this code and I didn't linked image but Caption title. Here I have done. This is my full working code.
How can I strip html tags in code here on github? any idea
So replace
<?php wp_reset_query(); ?>
with
array('post', 'news'), 'posts_per_page' => 5 ); $slider_query = new WP_Query( $args ); // Display the featured images in div echo ' '; while ( $slider_query->have_posts() ) : $slider_query->the_post() ; $attr = array( 'alt' => 'the-alt-tag', 'data-caption' => '#htmlCaption-'.$slider_query->current_post, ); if ( has_post_thumbnail() ) { the_post_thumbnail('home-slider-thumb', $attr); } else { ?> rewind_posts(); echo ' '; // Print the captions while ( $slider_query->have_posts() ) : $slider_query->the_post(); ?>
?
Can you pastebin it for me? the code parser here doesnt seem to be working http://pastie.org/5091886
@dannymichel
Here is the complete code now pasted http://pastie.org/5091895
@dannymichel
Have you checked code? Does it works for you? Also please provide modified code so I also can check for future use. :)
I am trying to add orbit slider with Wordpress theme and getting trouble to make it works with caption and title or the post
I want to display all latest post thumbnail on the slider (number defined in query) and excerpt as a caption + post title. I am getting images without any issue but I am not able to understand how to add caption dynamicaly within the same while loop. Because I have to keep loop in between
Below is my code. I would really appreciate your help