• Resolved sa_ostad

    (@sa_ostad)


    I want to use this plugin instead of Featured Image for posts to show slideshow only when list posts in category. but some of this posts has not any picture for slide show and has only one low quality picture for Featured Image. So in Theme I need check if there is album for post show slideshow and if there isn’t album show Featured Image.
    How can I get query of specific album in IF statement ?

    https://www.ads-software.com/plugins/wp-photo-album-plus/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    <?php
    
    $album_id = ....; // Fill in the album id
    
    if ( is_function( 'wppa_album_exists' ) ) { // wppa active
        if ( wppa_album_exists( $album_id ) ) { // Album exists 
    
            // Place code if album exists here
    
        }
        esle { // Album does not exists
    
            // Place code if album does not exist here
    
        }
    }
    ?>
    Thread Starter sa_ostad

    (@sa_ostad)

    Thank you Jacob.
    can I use $album_name instead of $album_id ?
    If it’s not possible how can find album_id from album_name ?

    Thread Starter sa_ostad

    (@sa_ostad)

    I complete my solution with google search. (thanks for Jacob old posts!)

    <?php
    if ( function_exists( ‘wppa_albums’ ) ){
    $posts_title = “$” . the_title(“”,””,false );
    global $wpdb;
    $album_name = the_title(“”,””,false ); // You know how to find the name
    $album_id = $wpdb->get_var( $wpdb->prepare( “SELECT id FROM “.WPPA_ALBUMS.” WHERE name = %s”, $album_name ) );
    if ( wppa_album_exists( $album_id ) )
    {
    echo wppa_albums( $posts_title, ‘slideonly’, ‘auto’, ‘right’);
    }
    else
    { // Album does not exists
    if ( has_post_thumbnail() ) :
    the_post_thumbnail();
    endif;
    }
    }
    else
    { //plugin not activated
    if ( has_post_thumbnail() ) :
    the_post_thumbnail();
    endif;
    }
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to check if album exist ?’ is closed to new replies.