Support » Plugin: Import Tweets as Posts » Integrating with new 'Tweet' post type

  • Resolved GuerillaRadio1

    (@guerillaradio1)


    Hi there. I’ve been using this plugin for a month or so now and it has been a lifesaver, so thanks to the developer. In the latest version it gives the option of importing as a custom post type rather than as a post which I would like to integrate so that my posts aren’t overly saturated by Tweets.

    How would I test for this post type in my templates? I usually use the Custom Post Type UI plugin where the syntax would be:

    $args = array(
        'post_type' => 'tweet'
    );
    $tweets = new WP_Query($args);
    
    if($tweets->have_posts()) {
    	while ($tweets -> have_posts()) : $tweets->the_post();
    		get_template_part('partials/tweet', 'post');
    	endwhile;
    	wp_reset_query();
    } else {
           //Get normal posts
    }

    However, it doesn’t look like this syntax works in this case. Thanks in advance.

    https://wordpress.org/plugins/import-tweets-as-posts/

Viewing 1 replies (of 1 total)
  • Plugin Author Chandan Kumar

    (@chandanonline4u)

    Thanks for good words. Your Wp_Query argument is right. You need to assign tweet as post type as you did in your code. You will have to check it now. If your code does not work. Try using the below code to check:

    $args = array(
      'post_type' => 'tweet'
    );
    $tweets = new WP_Query($args);
    if($tweets->have_posts()) {
      while ($tweets -> have_posts()) : $tweets->the_post();
        echo $post->post_title;
      endwhile;
      wp_reset_query();
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Integrating with new 'Tweet' post type’ is closed to new replies.