• 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 - 16 through 30 (of 81 total)
  • Thread Starter Joelle

    (@joelle)

    Yeah, I ditched that snippet and am working on something else. I hope. Nothing I’m trying seems to work just on the single post.

    But my permalinks settings are /post-name/

    Plugin Author jdalmeida

    (@jdalmeida)

    if your permalink settings is the %postname%, the category, ‘books’, will not appear.

    Plugin Author jdalmeida

    (@jdalmeida)

    the problem is wordpress removes the post name (the slug) if it finds out the post status is future (or draft, pending, etc), and then uses the ?p=xx instead…

    when the post is published it does (i defined category+postname)):
    https://the-future-posts.local/abc/as-she-drives/

    and when the post is future it does this way (it uses the plain permalink):
    https://the-future-posts.local/?p=42

    it’s stupid and annoying… i have just saw the wp get_permalink() code and this is the procedure.

    so, i’m working on a solution in order to have the postname on future posts. justv this. having more than this, like categories, it’s a quite complex thing as it is difficult to test.

    Thread Starter Joelle

    (@joelle)

    I scrapped that snippet and instead used the Show Future Posts on Single Posts plugin, which worked fine. I tried pulling out the code from the plugin to drop in my functions file (credited, of course) just to avoid excess plugins, but it broke the universe, so I’m just going to stick with it in the plugin. ?? In case that’s help for you or anyone else.

    Re: pretty permalinks
    I think your “old method” (as noted in your file) may be the better route because with just the post_name, it leaves off any other segments associated with the post. I probably won’t be the only person to run into that issue.

    That said, I found a snippet that works really well and changes the URL for future posts to a nice, tidy permalink like normal:

    // Nice URL for Future Posts
    // // post, page post type
    add_filter( 'post_link', 'future_permalink', 10, 3 );
    // custom post types
    add_filter( 'post_type_link', 'future_permalink', 10, 4 );
    
    function future_permalink( $permalink, $post, $leavename, $sample = false ) {
    	/* for filter recursion (infinite loop) */
    	static $recursing = false;
    
    	if ( empty( $post->ID ) ) {
    		return $permalink;
    	}
    
    	if ( !$recursing ) {
    		if ( isset( $post->post_status ) && ( 'future' === $post->post_status ) ) {
    			// set the post status to publish to get the 'publish' permalink
    			$post->post_status = 'publish';
    			$recursing = true;
    			return get_permalink( $post, $leavename ) ;
    		}
    	}
    
    	$recursing = false;
    	return $permalink;
    }

    Found here!

    It doesn’t seem to have broken anything. Everything is functioning as intended. So SUCCESS! ??

    The only thing that would be perfection right now is if I could show the taxonomy or category the post is filed in. But I understand that might be more complex. Thank you for all your help with this. I’ll be on the lookout if you happen to figure out that last bit.

    • This reply was modified 6 years, 8 months ago by Joelle. Reason: added link to plugin
    • This reply was modified 6 years, 8 months ago by Joelle.
    Plugin Author jdalmeida

    (@jdalmeida)

    hi joelle,

    please update to v1.24. plenty of great news:

    = 1.24 – 2018-07-22 =

    * Abandoned previous version’s method of using pretty permalinks based on ‘Post name’. Bad idea…

    * Added a new method of having pretty permalinks in ALL posts (including ‘Future’ posts), keeping WordPress’ Permalink Settings whatever they may be. For instance: https://the-future-posts.local/my-category/sample-post/. Thanks, Joelle!

    * Now all posts, incluing Future, Draft, Pending, Private, etc, will be shown to anonymous non-logged users, just like Published posts. By default, WordPress returns a 400 error page when a future post is being accessed (thus preventing a future post to be shown), unless accessed by a logged Administrator. This was happening up until now. Not anymore!

    Plugin Author jdalmeida

    (@jdalmeida)

    look, ma, i have categories on v1.30 !!!

    Thread Starter Joelle

    (@joelle)

    YESSSS!!! You made so many changes, that’s so helpful, thank you! ?? can’t wait to update it and give it a go.

    Plugin Author jdalmeida

    (@jdalmeida)

    yes, i had a great coding night, where everything i did went just perfectly. that’s not always the case…

    so, please do test it, it’s rather needed.

    i have now a much better plugin. thanks.

    Thread Starter Joelle

    (@joelle)

    Hello! I updated and so far here’s the bad, the good and the unknown:

    I’m not getting nice permalinks. It’s doing the thing where it links to unpublished url again. (I did remove that snippet from my functions.php to test if yours worked, just to be sure, but no – the unpublished link is what comes up)

    I *am* able to get to the future post when not logged in. Yay!

    How do I display the taxonomy?
    I read your docs that you updated for how to use the taxonomy terms. Silly me. ??

    Thank you!

    • This reply was modified 6 years, 8 months ago by Joelle.
    Thread Starter Joelle

    (@joelle)

    Okay, maybe I do need more instruction on those taxonomies. I was trying:

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

    Is that not right? I tried taxonomy=’series’, also, but neither produced any results for me. ?? Suggestions appreciated!

    Oh, I see what I did. I needed categories=text;link under fields. But it’s not pulling up anything, so I have to assume it’s because it’s a custom taxonomy?

    • This reply was modified 6 years, 8 months ago by Joelle. Reason: typo
    • This reply was modified 6 years, 8 months ago by Joelle.
    Plugin Author jdalmeida

    (@jdalmeida)

    enlight me: books are a custom post type, with its own caterogies and tags. books is not a category within posts?

    as i recall (i’m on my mobile phone), custom posts need differente settings. this is described on the shortcodes page on the column “where to use” (i don’t recall the exact name).

    Thread Starter Joelle

    (@joelle)

    Yup! books is the CPT and series is the taxonomy for that post type.

    Plugin Author jdalmeida

    (@jdalmeida)

    this way:

    [the_future_posts post_status=”future” post_type=”books” taxonomy=”books_category” taxonomy_terms=”series” posts_per_page=”6″ orderby=”date” order=”ASC” posts_per_column=”1″ fields=”div=start;class=’release_list’|title=text;link|categories=text;link|date=text;nolink;F Y|div=end”]

    Thread Starter Joelle

    (@joelle)

    Ah! Thank you! The books_category is “series”, there are a whole bunch of series. I want it to show whatever series that book belongs to without having to manually set it. Make sense? ??

    Plugin Author jdalmeida

    (@jdalmeida)

    in that case, do not specify the taxanomy_terms= and then anything will go.

    and you shouldn’t need the taxonomy= either.

    you should only need the post_type=

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