Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How display posts from category and tag using shortcode in Wordprss

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #43726
    shaifshahin
    Participant

    I tried with this code, but this is not perfect.

    I want it like that [artist category=video&&tag=8]

    But below the code working only for tag id 7, for working shortcode like this, how i change in on the code

    I tried with this code, but this is not perfect.

    I want it like that [artist category=video&&tag=8]

    But below the code working only for tag id 7, for working shortcode like this, how i change in on the code

    #129991
    shaifshahin
    Participant


    function recent_posts_function($atts) {
    extract(shortcode_atts(array(
    "category" => 'video',
    "tag" => '7',

    ), $atts));

    $args = 'my_video';
    $args = $category;
    $args = 12;

    $args = false;
    $args=$tag;
    // query_posts($args);
    $query = new WP_Query( $args );
    $counter = 0;


    ?>



    $counter = 0;

    if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
    $query->the_post(); $counter++;
    ?>




    $args = 'key=image&width=' . $my_options . '&height=' . $my_options . '&class=thumbnail&link=img&return=true&id=' . get_the_ID();

    echo ' 0 ) ) . '">' . my_image_vimeo( $args ) . '';
    ?>


    " rel="bookmark" title="">












    } // End WHILE Loop
    echo '
    ';
    //my_pagination();
    wp_reset_postdata();
    remove_filter( 'pre_get_posts', 'my_filter_homepage_videos_query' );
    } else {
    ?>











    wp_reset_query();
    return $return_string;
    }
    function register_shortcodes(){
    add_shortcode('artist', 'recent_posts_function');
    }
    add_action( 'init', 'register_shortcodes');
    add_filter('widget_text', 'do_shortcode');

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.