0

I am currently running into a problem where I have to combine my Custom Post Type posts with the feed of a facebook page and a twitter channel. I know that there are a lot of plugins out there that display the individual feeds using a short code, but I can't implement that into the design necessity I am facing - all posts are displayed in a grid via masonry.js and the twitter and facebook "posts" should be displayed inside of this grid with the same look and feel as the other posts.

I am getting my custom posts via the following query using the loop:

$args = array( 
    'post_type' => 'eunv_tilemanager', 
    'posts_per_page' => -1,

    'meta_query' => array(
        'relation' => 'AND',
        'priority_clause' => array(
            'key' => 'prioritat',
            'compare' => 'EXISTS'
        )
    ),
    'orderby' => array(
        'priority_clause' => 'DESC',
        'date' => 'DESC'
    )
);
$loop = new WP_Query( $args );

The perfect solution would be if I could import the facebook/twitter feed of a page into the posts query, give them a priority as well as the date the fb/twitter post was published, so I could keep my current sorting as is.

If there is any other possible solution, I'd gladly take any hints. If it helps and offers such possibility, I've bought the plugin FlowFlow to display social media walls on another page.

Thank you in advance and best regards

Nick

  • Facebook and Twitter posts aren't in the WordPress database so you're not going to be able to query them unless you somehow sync them regularly and import them as posts. That's a fair bit of work. That plugin you linked supports RSS, so why not just add your site's RSS feed as a source to that. Would be much simpler. – Jacob Peattie Apr 16 '18 at 12:42
  • I know that there are a ton of simpler ways than the one I described, but that's a requirement I've been given and I have to work around that. I can't simply add a RSS feed because that would not work with the post layout and order. – N. M. Apr 16 '18 at 13:11
  • I hope that requirement came with a stack of cash because you're in for a fair bit of work if you can't find any plugins. Unfortunately it would be outside the scope of a single answer on this forum. You're going to need to: Authenticate with each API, send requests to them and process responses, turn those responses into posts, schedule requests regularly, handle deleted and changed posts, then query them. Each of those would be its own question. So you'll either need to ask each of those questions, hire someone, or keep looking for plugins. The last two are off-topic here though. – Jacob Peattie Apr 16 '18 at 13:23
  • That's basically what I thought I'd have to do. Using the public APIs of Facebook and Twitter is something I have done in the past, combined with the tasks you mentioned, so I am definitely capable of doing that again. I just hoped that I would be able to avoid having to do that over. – N. M. Apr 16 '18 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.