Support » Plugin: The Future Posts » Custom Classes & Showing Taxonomies

  • Resolved Joelle

    (@joelle)


    Hello! I’m trying to figure out three things:

    1. The class=”whatever” doesn’t seem to be working. I copied it right from your example: field=”div=start;class=”release_list”;div=end;” but that doesn’t seem to be working. Its not applying my class to the div.

    2. I was curious if it’s possible to show the taxonomy somehow? Not filter by taxonomy, but actually display the taxonomy it’s part of under the title or whatever, like a blog post might. (like you’re showing the author now, but the taxonomy)

    3. I can hide this with CSS, but is it possible to *not* include an image, even if there is one? Like to show the future posts in a list?

    Thank you!

Viewing 15 replies - 1 through 15 (of 81 total)
  • A follow-up:
    when I removed the field=”div=start;class=”release_list”|div=end;” bits, then the image went away, as did anything else I didn’t want. So that’s good. Except I need to assign a custom class to each div so I can style them appropriately for each area they’re in. How do I do that so that it works?

    And then still the taxonomy thing. πŸ™‚ Thanks again!

    Here is what my shortcode looks like:

    [the_future_posts post_type="books" posts_per_page="6" orderby="date" order="ASC" posts_per_column="1" fields="div=start;class="release_list"|title=text;link|date=text;nolink;F Y|div=end"]

    If I could just get my class to apply, the rest would be easy to style. But the class bit doesn’t seem to work.

    I also noticed that the links on these go to a URL like this: /?post_type=books&p=7228 and not like this /books/unarcana-stars/ which is how the URL actually looks. I thought it was because it was a future post, but I think it’s how the permalink is set up in the plugin. Because the actual nice URL does work still, despite being a future post.

    Oh and I would be happy to make a donation for this, if we can just get it working. πŸ™‚

    • This reply was modified 2 years, 3 months ago by Joelle. Reason: updated about donating
    Plugin Author jdalmeida

    (@jdalmeida)

    hi joelle!

    sorry for not replying soon, but i didn’t get any email notification.

    the class didn’t work because you used ” characters. use ‘ characters instead. use like this:

    fields=”div=start;class=’release_list’|title=text;link|date=text;nolink;F Y|div=end”

    Plugin Author jdalmeida

    (@jdalmeida)

    joelle,

    i’m trying to find a solution for your permalink problem. stay tuned.

    best,
    josΓ© de almeida

    Plugin Author jdalmeida

    (@jdalmeida)

    dear joelle,

    i’m not 100% confident, but i think i have solved the permalink issue.

    it now shows the post permalinks based on ‘Post name’ (http://the-future-posts.local/sample-post/) instead of ‘Plain’ (http://the-future-posts.local/?p=123).

    update to v1.23 and let me know if it worked for you.

    tomorrow i will work on the taxonomy issue. i though about it, but i didn’t think people will need to use it. so i was wrong. πŸ™

    best,
    JdA

    Thank you! One thing about the permalinks: if you are logged out and you try to click a link on a future post, it gives you a 404. I think this is because the posts aren’t actually published. But then, if you can’t go to the link, why have links? πŸ™‚ I’ll upgrade and maybe it fixes it, but that was a confusing thing. Thanks again!

    Hello again!

    Okay, I’ve updated the plugin and here’s what I know so far:

    1. I got the class situation sorted out. I’d copied it from your docs (somewhere?) and didn’t account for the double quote. Silly me. πŸ™‚

    2. The permalinks go to the nice URL now. Thank you!

    3. Now to just figure out how to give access to the future post… maybe setting the query to show both future and publish in a custom single post template. *thinks* Otherwise, there’s really no point to linking to these future posts. πŸ™‚

    Thank you for your help! I appreciate your fast turn-around.

    x

    Plugin Author jdalmeida

    (@jdalmeida)

    hi!

    it’s a complex issue. wordpress does not allow future posts to be viewed by non-logged users. only by administrators, if logged.

    still, there’s a workaround for this, either by using a third-party plugin, or by incorporating the feature into the future posts self code. i’ll think about which one is best.

    stay runed,
    JdA

    Plugin Author jdalmeida

    (@jdalmeida)

    that div class situation you are doing, there’s a better way to do it, unless you have some specific need about it.

    by using the custom theme prefix, not the default but the custon, or by creation your own, i can have a lot more CSS control over the whole thing.

    check the Themes menu. by using the .tfp classes (there’s a bunch of them), you can control each field.

    Oops! One thing I did notice ont he permalinks: it’s not grabbing the full URL. It’s only adding the last segment, but doesn’t include the custom post type. For example instead of /books/darkness-beyond/ it’s going to /darkness-beyond/.

    Re: the classes – I need that specifically for that area because I’m making it a simple list, as opposed to a grid. And I’m using it elsewhere as a grid with a book cover image, so it’s just for this particular section. πŸ™‚

    I found this:

    // Show Single Future Posts
    add_filter('the_posts', 'show_future_posts');
    function show_future_posts($posts){
       global $wp_query, $wpdb;
       if(is_single() && $wp_query->post_count ==0){
          $posts = $wpdb->get_results($wp_query->request);
       }
       return $posts;
    };

    But it doesn’t seem to work, despite me re-saving the permalinks. I feel like I’m so cloooose. πŸ™‚

    YASSSSS!

    //DISPLAY FUTURE POST TYPES
    add_filter( 'pre_get_posts', 'get_future_posts' );
    function get_future_posts( $query ) {
    	if ( is_home() && $query->is_main_query() )
    		//IF YOU WANT TO INCLUDE CUSTOM POST TYPES
    		$query->set( 'post_type', array( 'post', 'your_custom_post_type' ) );
    		//INCLUDE POSTS WHOSE STATUS IS BOTH PUBLISHED AND FUTURE
    		$query->set( 'post_status', array( 'publish', 'future' ) );
    	return $query;
    }

    This works, in case anyone ever needs it. πŸ™‚ Totally works. Just drop it in functions.php and adjust for your particular needs. It’s a glorious day. haha!

    I found it here: http://www.preventweirdness.com/functions/future-posts-on-index-php-and-single-php/

    THIS JUST IN: well, that snippet *did* work, but it also set it everywhere and not just on single posts. I also tried is_singular(‘books’), just in case. Didn’t work. I’m working on it, but just in case anyone wanted to try that… YMMV.

    But! Back to your plugin. πŸ™‚ The only things that would be helpful are:
    * display taxonomy/category
    * the url going to the full url and not just the last segment (if possible)

    I appreciate you considering these changes!

    Plugin Author jdalmeida

    (@jdalmeida)

    the snippet acts like brute force. it just throws everything everywhere. as such, you don’t have much control with it.

    what Dashboard/Settings/Permalinks common settings do you have?

Viewing 15 replies - 1 through 15 (of 81 total)
  • The topic ‘Custom Classes & Showing Taxonomies’ is closed to new replies.