How to create a new [photo_wall2] shortcode?

  • Posted in : Photographer
  • almondpix
    Participant

    i want to get a new photo_wall shotcode or call named “photo_wall2”. which able to set rows and columns. is it possible, am i got it? thank you

    almondpix
    Participant

    or add new original photowall attribute named “rows” or so on. such as [photo_wall animation=”random” interval=”1600″ max_step=”3″ rows=”5″]

    Thank you

    almondpix
    Participant

    i try to add “rows” attribute in to themes

    functions.php
    @Line 2468 replace function photo_wall( $atts, $content = “” );
    ========================================================================

    function photo_wall( $atts, $content = "" )
    {
    extract( shortcode_atts( array( 'animation' => "random",
    'rows' => "3",
    'interval' => "1600",
    'max_step' => "3" ), $atts ) );

    $output = "";
    $images = "";
    $items_count = 1;

    $args = array( 'post_type' => 'portfolio',
    'orderby' => 'rand',
    'posts_per_page' => -1 );

    $loop = new WP_Query( $args );

    if ( $loop->have_posts() ) :
    while ( $loop->have_posts() ) : $loop->the_post();

    $post_content = get_the_content();

    if ( preg_match( '/\[gallery.*ids=.(.*).\]/', $post_content, $ids ) )
    {
    $ids_in_array = explode( ',', $ids[1] );

    foreach ( $ids_in_array as $item_id )
    {
    $image = wp_get_attachment_image_src( $item_id, 'thumbnail' );

    if ( $image[0] != "" )
    {
    if ( $items_count <= 100 )
    {
    $images .= '';

    $items_count++;
    }
    }
    }
    }

    endwhile;

    if ( $images != "" )
    {
    $output = '' . $images . '';
    }

    endif;
    wp_reset_query();

    return $output;
    }

    add_shortcode( 'photo_wall', 'photo_wall' );

    almondpix
    Participant

    sorry, it has a some problem with a posted message.

    please see this link https://www.dropbox.com/s/58yiaqft9nynlg3/issue-photowall.txt?raw=1 instead

    Is it has any effect or problem with my theme? if i do like this.

    Thank you for support.

    serkan
    Moderator

    Hi,
    If you don’t encounter any issues, you can just use it.
    Thanks

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register