Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter amurado

    (@amurado)

    @cedcommerce Is there no way to fetch all posts AFTER today with your code? Using something like the below:

    'date_query' => array( 'after' => "today" )

    Thank you

    Thread Starter amurado

    (@amurado)

    @tsure: Yes, that’s correct. I’ve set it so scheduled posts show up on the front end. This is a custom post type for “movies” to use as a movie database. So future movies will need to be shown.

    Thread Starter amurado

    (@amurado)

    @cedcommerce Tried that and changed the post type to “movies” and it didn’t work. It now doesn’t show any posts on the front.

    @tsure Just took a look at that thread and it seems pretty similar to the above code and it didn’t work.

    Not sure what I’m doing wrong.

    Thread Starter amurado

    (@amurado)

    Thanks for everyone for your help! Much appreciated. Used Michael’s method and it seemed to do the trick. Thank you!

    Thread Starter amurado

    (@amurado)

    Thank you very much, that code did the trick!

    Thanks for also being very nice. Some people can be quite rude when clearly people are still trying to learn the ins and outs of WordPress. Will definitely continue to read and learn more.

    Thanks again.

    Thread Starter amurado

    (@amurado)

    Hi bcworkz,

    Thanks for you reply! I just tried adding the curly braces as you mentioned, and while the media library works again, it no longer shows my future movies on the frontend. Have I done something wrong?

    Unfortunately, I don’t know much about this and your last paragraph does slightly confuse me. Are you able to look at my updated code and let me know what I need to do?

    Thanks for your help so far!

    //DISPLAY FUTURE POST TYPES
    add_filter( 'pre_get_posts', 'get_future_posts' );
    function get_future_posts( $query ) {
    	if ( is_home() && $query->is_main_query() ) {
    	$query->set( 'post_type', array( 'movies' ) );
    	$query->set( 'post_status', array( 'publish', 'future' ) );
    }
    	return $query;
    }
    // SHOW FUTURE POSTS SINGLE.PHP
    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;
    }
    add_filter('the_posts', 'show_future_posts');

    Anyone have any updates on this? I’m looking for the same functionality too.

    Thank you

    Thread Starter amurado

    (@amurado)

    Hey,

    The author of my plugin replied and said the following. Let me know if it helps our situation and if you have any ideas?

    Just had a look at your discussion about this other plugin and future posts. The author is right when he says nothing in these functions is directly related to future posts, but empty terms are indirectly related: terms are considered “not empty” only if they contain published posts, so terms with only draft or scheduled posts are considered “empty”.
    So the solution may involve setting the ‘hide_empty’ parameter (true by default) to false when calling wp_dropdown_categories() (this function will then pass this argument to get_terms() ).

    Thanks!

    Thread Starter amurado

    (@amurado)

    Trying for the second time today to donate, never goes through ?? After clicking on the button to place the order it just has the loading animation.

    Will try again later!

    Thread Starter amurado

    (@amurado)

    Hi,

    Yes, they appear in archives. The plugin (WPMDB) that creates the CPT posts does use pre_get_posts to show them. This is what the plugin uses:

    add_filter('pre_get_posts','wpmdb_show_future_posts');
    function wpmdb_show_future_posts($query) {
    if (!is_admin()&&!is_single()) $query->set('post_status','publish,future');
    	return $query;
    }
    
    add_filter('the_posts', 'show_all_future_posts');
    function show_all_future_posts($posts) {
       global $wp_query, $wpdb;
       if(is_single() && $wp_query->post_count == 0) $posts = $wpdb->get_results($wp_query->request);
       return $posts;
    }

    I can’t seem to find anything online ?? I’ll try and ask the plugin’s author and report back.

    Thanks!

    Thread Starter amurado

    (@amurado)

    Apologies for the extra post, but is it possible to select multiple options in a certain dropdown? So for genre, can I select both Action AND Crime for example?

    Thanks

    Thread Starter amurado

    (@amurado)

    Never mind, I figured it out. Was adding a hyphen to my URL for some reason. Fixed in functions.php file.

Viewing 12 replies - 1 through 12 (of 12 total)