• Resolved Anointed

    (@anointed)


    I created new post_type and it works. But why do I not have the option to make my custom single post ‘sticky’?

    Do I need to add the ability when creating the post_type?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sticky posts are a special animal but they are posts, not a different post type. You’ll have to use a special loop to display that particular post type. Here’s an example where a custom field key of sticky and a value of yes qualify this post type of book to be displayed:

    <?php
    $args=array(
      'meta_key'=>'sticky',
      'meta_value'=> 'yes',
      'post_type' => 'book',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of Books with sticky = yes custom field';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
        the_content();
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    Thread Starter Anointed

    (@anointed)

    Thank you Michael

    I completely misunderstood the functionality behind sticky posts. I was under the wrong impression that when I created a new post_type, that the ability to make a custom post_type ‘sticky’ via the same drop down would be there.

    Saved me tons of head banging

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘sticky post_type?’ is closed to new replies.