• 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)
  • Thread Starter Joelle

    (@joelle)

    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!

    Thread Starter Joelle

    (@joelle)

    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 6 years, 8 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’ (https://the-future-posts.local/sample-post/) instead of ‘Plain’ (https://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

    Thread Starter Joelle

    (@joelle)

    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!

    Thread Starter Joelle

    (@joelle)

    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.

    Thread Starter Joelle

    (@joelle)

    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/.

    Thread Starter Joelle

    (@joelle)

    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. ??

    Thread Starter Joelle

    (@joelle)

    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. ??

    Thread Starter Joelle

    (@joelle)

    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: https://www.preventweirdness.com/functions/future-posts-on-index-php-and-single-php/

    Thread Starter Joelle

    (@joelle)

    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.