Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 28 total)
  • Author
    Posts
  • in reply to: Is it possible to show the post type in the list? #29472
    Joon
    Participant

    I gather this would be hard to solve?

    in reply to: Is it possible to show the post type in the list? #29247
    Joon
    Participant

    Unfortunately that code does not work. The page does not look right.

    I have it activated on a demosite so no other plugins or code snippets should be messing with the code: (https://museo.eitcon.com/)

    in reply to: Is it possible to show the post type in the list? #29196
    Joon
    Participant

    Yeah I get that 🙂

    What I mean is how I get the links removed from the dates in the traditional posts without messing up the code that shows the schedule details for events.

    in reply to: Is it possible to show the post type in the list? #29182
    Joon
    Participant

    Ok you were right. I had a code in code snippets affecting the end result.

    I had this code that removes the link from the date. Is it possible to still remove the link?

    add_filter( 'wpsp_date_output', 'tu_wpsp_remove_date_link' );
    function tu_wpsp_remove_date_link() {
        $time_string = '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    
        if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
            $time_string .= '<time class="wp-show-posts-updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
        }
    
        $time_string = sprintf( $time_string,
            esc_attr( get_the_date( 'c' ) ),
            esc_html( get_the_date() ),
            esc_attr( get_the_modified_date( 'c' ) ),
            esc_html( get_the_modified_date() )
        );
    
        printf(
            '<span class="wp-show-posts-posted-on wp-show-posts-meta">%1$s</span>',
            $time_string
        );
    }
    in reply to: Is it possible to show the post type in the list? #29180
    Joon
    Participant

    Yeah something weird is clearly going on. I tested it out on a blank demosite with only WPSP and The Events Calendar and the code works perfectly!

    So clearly something on my end messing with the outcome. I’ll look into it and let you know.

    But thanks for the help again! 🙂

    in reply to: Is it possible to show the post type in the list? #29127
    Joon
    Participant

    Ok. So I guess there is something else happening with The Events Calendar plugin that leads to WPSP using the eventdate for sorting instead of the publishing date of the post.

    I tried the code you posted but still the date shows up twice? Do you think this could be a problem with their function?
    https://pji.eitcon.com/

    in reply to: Is it possible to show the post type in the list? #29122
    Joon
    Participant

    And I just realized that the wpsp_date_output filter is tied to what date is used in the sorting also?

    So my code seems to make the event date be prioritized over the post date when sorting by date.

    in reply to: Is it possible to show the post type in the list? #29120
    Joon
    Participant

    Thanks for the help again!

    So the wpsp_date_output filter was exactly what I was looking for.

    I did some tests with the code above, and realized that using the _EventStartDate custom field was not the best way to pull the event info from the plugin. They had a function for doing it better (https://docs.theeventscalendar.com/reference/functions/tribe_events_event_schedule_details/).

    I ended up using the code below. Still having some problems. I think it has something to do with the wpsp_date_output? It almost works but with this code it first shows the post date, and then the event details… (https://pasteboard.co/JWXddSF.jpg)

    How would I get rid of the postdate?

    add_filter('wpsp_date_output',function(){
        if ( 'tribe_events' == get_post_type() ) { 
            return tribe_events_event_schedule_details($null, $before = 'Event date: ');
    	}
    });
    
    in reply to: Is it possible to show the post type in the list? #29052
    Joon
    Participant

    So I already have the script checking if it’s a CPT, and I already have the custom field there. I just need to get the postdate replaced. Like this would be ideal! https://pasteboard.co/JWwgCaK.png

    in reply to: Is it possible to show the post type in the list? #29050
    Joon
    Participant

    It works! Thank you. I know this may be getting a bit out of hand but I ran into another issue with the list.

    I am listing both traditional posts and events (CPT) in the same list, but WPSP shows the publishing date of the post, as it should. But because I have an event, it would be more logical to show the date of the event instead.

    I already achieved a working code, so I am really close! The code checks if its the CPT with Events, and displays the date in the post like this: https://pasteboard.co/JWwd44z.png
    But would it be possible to replace the post-date with this code?

    if ( 'tribe_events' == get_post_type() ) {
    		echo '<div class="wpsp-post-type-name"><a href="'.$cpt_archive_link.'">'.$post_label.'</a></div>';	
    		$startDate = strtotime( get_post_meta( get_the_ID(), '_EventStartDate', true ));			
    		$startDate = date( 'j.n.Y', $startDate );
    		echo 'Event date: ',$startDate;
                    }
    in reply to: Is it possible to show the post type in the list? #29004
    Joon
    Participant

    Ah one thing I didn’t realize… Would it be possible to link the CPT to the CPT archive?

    in reply to: Is it possible to show the post type in the list? #29002
    Joon
    Participant

    That’s perfect. Thank you! 🙂

    in reply to: Including more than one post type #28279
    Joon
    Participant

    A “sticky featured tag” would also serve the same purpose..

    in reply to: Including more than one post type #28266
    Joon
    Participant

    So the code above works fine but I have a last question. Would it be impossible to prioritize some categories over others?

    95% time we will publish traditional posts/news but when we post stuff from these two other categories, it would be nice if we could “pin” these posts there for a while. Right now the only way to do that is to keep changing the date of these posts to keep them showing in the list. And because these are custom post types, the sticky feature in WordPress is not working. So would there be any to get post from these specific categories to “bypass” the traditional posts?

    There were some discussions here about prioritizing a specific category but I did not find a final solution…
    https://wpshowposts.com/support/topic/show-posts-in-current-category-and-specific-tag/

    in reply to: Including more than one post type #28222
    Joon
    Participant

    Thank you!!

    add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
     if(16270 === (int)$settings['list_id']){
        $args['post_type'] = array('post','tribe_events');
    	$args['tax_query'] = array(
    			'relation' => 'OR',
    			array(
    				'taxonomy' => 'category',
    				'field'    => 'slug',
    				'terms'    => array( 'category_name' ),
    			),
    			array(
    				'taxonomy' => 'tribe_events_cat',
    				'field'    => 'slug',
    				'terms'    => array( 'category_name' ),
    			),
        	);
      }
      return $args;
    }, 15, 2 );
    

    This is the code I ended up with and it seems to do the job 🙂 If someone is using The Events Calendar and wants to pull single events to a WPSP list by adding it to a specific category, just rename the category_name in the code above.

Viewing 15 posts - 1 through 15 (of 28 total)