Support » Plugin: WP RSS Aggregator » loop with feed items and source id

  • Resolved simxware

    (@simxware)


    Hi, I need to do a loop of all items (with “wprss_feed_item” ?? ) and I need each of this show the source feed id.

    So i need the loop outpus as

    feed id
    feed source id
    feed item
    feed data
    etc…
    etc…

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @simxware,

    If you’d like to modify the default feed items display template, you can do that by using the feed_output filter.

    You can read more about this here.

    I think is not what I need.

    I need to build a wp_query that output
    feed id
    feed source id
    feed item
    feed data

    I’ve this code now:

    $query_args = array(
                    'post_type'             => 'wprss_feed_item',
                    'posts_per_page'        => 1,
                    'ignore_sticky_posts'   => 'true',
                    'orderby'               => 'date',
                    'order'                 => 'DESC',
                    );
            $query = new WP_Query($query_args);
    
            if( $query->have_posts() ){
                while($query->have_posts()){
                    $query->the_post();
    echo "<pre>";
    print_r($query); // or var_dump($data);
    echo "</pre>";
                }
            }
            
            wp_reset_query();
            wp_reset_postdata();

    but I can only output feed id and not the source-id of the feed

    Can you help me?

    Hi @simxware,

    but I can only output feed id and not the source-id of the feed

    Did you mean you can already get the wprss_feed_id post meta? If so, that’s actually the Feed Source ID for the respective Feed Item.

    The Feed Item ID itself should be the post ID or the one that can be called with get_the_ID().

    Is that what you’re looking for?

    I already get feed id, I need feed SOURCE id
    Take this as data:

    source 1 [id 1234]
    - feed_a [12]
    - feed_b [34]
    source 2 [id 4321]
    - feed_c [56]
    - feed_d [78]

    I need a loop that output something like:

    feed_a 12 1234
    feed_b 34 1234

    In the same loop of the wrss_items I need to output the source them come from, I need this data to use it as class of the item element

    Home is clean now

    Hi,

    If you need Feed Source ID, then inside your loop, you can call it with something like:

    
    $feed_source_id = get_post_meta( get_the_ID(), 'wprss_feed_id', TRUE );
    echo $feed_source_id;
    

    Will this work for you?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.