• Resolved FELiXik

    (@felixik)


    Hello,
    I would like to have all posts from one category formated to tabs:

    TAB title is Post title and TAB content is post content

    Is this possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter FELiXik

    (@felixik)

    I tried to use

    [su_posts template="templates/my-list.php"]

    with my code:

    <?php echo do_shortcode("[su_tabs vertical=\"yes\"]"); ?>
    
    <?php
    // Posts are found
    if ( $posts->have_posts() ) {
    	while ( $posts->have_posts() ) {
    		$posts->the_post();
    		global $post;
    ?>
    
    <?php echo do_shortcode("[su_tab title=\". the_ID() .\" disabled=\"no\" anchor=\"\" url=\"\" target=\"blank\" class=\"\"]"); ?>
    
    <?php echo do_shortcode("[/su_tab]"); ?>
    
    <?php
    	}
    }
    ?>
    
    <?php echo do_shortcode("[/su_tabs]"); ?>

    but the only output to web is [/su_tab] [/su_tabs]

    Plugin Author Vova

    (@gn_themes)

    Hi @felixik,

    the working example:

    <?php
    
    $my_tabs = '';
    
    if ( have_posts() ) :
    
    	while ( have_posts() ) :
    
    		the_post();
    
    		$my_tabs .= sprintf(
    			'[su_tab title="%s"]%s[/su_tab]',
    			esc_attr( get_the_title() ),
    			get_the_content()
    		);
    
    	endwhile;
    
    endif;
    
    echo do_shortcode( '[su_tabs]' . $my_tabs . '[/su_tabs]' );
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘posts to tabs’ is closed to new replies.