Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #726533

    brandonlar
    Participant

    Hi is there anyway to implement rss feeds with accordion to be on a page?

    #726558

    Rad
    Moderator

    Hi there,

    Thanks for posting in.

    It’s not possible, it should be in the correct format so RSS reader can fetch it correctly. Though, I’m not sure why you need it like that? Or do you wish to display RSS feed content from another URL to your site?

    Thanks.

    #726580

    brandonlar
    Participant

    Hey. Yeah i want to display a rss feed content from another url to my site, and display that content in an accordion format. Is there a way to do that?

    #726617

    Rad
    Moderator

    Hi there,

    Not possible by available options, but doable by custom development. I can’t really provide a complete solution but I can provide some recommendations.

    For example, you can use the same code here:

    https://codex.wordpress.org/Function_Reference/fetch_feed

    But instead of using <ul><li></li></ul>, you will replace them with accordion’s shortcodes.

    Example, this block of code:

    <ul>
        <?php if ( $maxitems == 0 ) : ?>
            <li><?php _e( 'No items', 'my-text-domain' ); ?></li>
        <?php else : ?>
            <?php // Loop through each feed item and display each item as a hyperlink. ?>
            <?php foreach ( $rss_items as $item ) : ?>
                <li>
                    <a href="<?php echo esc_url( $item->get_permalink() ); ?>"
                        title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>">
                        <?php echo esc_html( $item->get_title() ); ?>
                    </a>
                </li>
            <?php endforeach; ?>
        <?php endif; ?>
    </ul>

    Should be changed to:

    $shortcode = '';
    
    if ( $maxitems >= 1 ) {
    
    $shortcode.='[x_accordion id="my-feeds-accordion"]';
    
    foreach ( $rss_items as $item ) : 
    
    $shortcode.='[x_accordion_item title="'.$item->get_title().'" parent_id="my-feeds-accordion"]'.$item->get_description().'[/x_accordion_item]';
    
    endforeach;
    
    $shortcode.='[/x_accordion]';
    
    echo do_shortcode( $shortcode );
    
    }

    Thanks!

    #728427

    brandonlar
    Participant

    hi sorry i haven’t manage to try your recommendation as i’m now having trouble fetching the rss feed. is there a theme conflict with fetching this link? it returns a timeout.

    #728499

    Christopher
    Moderator

    Thanks for writing in! It sounds like you might be having an issue with a third party plugin or script. Regretfully, we cannot provide support for third party plugins or scripts as our support policy in the sidebar states due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.

    Thank you for your understanding.

    #818265

    brandonlar
    Participant

    Hi, noted. Just wanted to update you that I’ve managed to implement rss with accordion. Thanks for your help!

    Also, is there a way i can add a line break after every sentence or specific data? Cause it appears as one whole chunk now.

    #818352

    Zeshan
    Member

    Hi Brandon,

    Please provide us with the URL of page where you have the feed so we can take a closer look and provide you with a tailored response.

    Thank you!

    #818375

    brandonlar
    Participant
    This reply has been marked as private.
    #818637

    Rupok
    Member

    Hi there,

    Thanks for updating. Simple there is no way to control the text since they are just plain text without any tag. If you want to change line height, font-size, color etc. then you can use the following selector :

    .x-accordion-inner {
      line-height: 28px;
    }

    Hope this helps.

    Cheers!