• Resolved smazzoni

    (@smazzoni)


    Hi,

    I googled and searched everywhere about a simple thing and I couldn’t find the way of get an array with the last created albums and their thumbs. I basically want to get the title, the date and a thumbnail of the lass three albums to display on the homepage of my website. I’ve tried with WP_Query but no success.

    Is there a way of doing this without writing my own function?

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

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

    (@opajaap)

    Try this shortcode on your homepage:

    [wppa type="cover" album="#last,0,3"][/wppa]

    It shows the album covers of the 3 most recently modified albums, being most likely the youngest created albums.

    If you use the keyword w#timestamp in the album description, it will be converted to the formatted date/time of last modification.

    For more info see: https://wppa.opajaap.nl/shortcode-reference/ and https://wppa.opajaap.nl/geographic-data/

    Thread Starter smazzoni

    (@smazzoni)

    Hi Jacob,

    I’ve tried your code on the template (sidebar.php) but the shortcodes are not being read, the display is just: [wppa type=”cover” album=”#last,0,3″][/wppa]

    It seems that the shortcodes aren’t being converted. If I use your code on a post it works, but not on templates.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    On a template, try this: ( not tested but should work )

    <?php
    global $wppa;
    $wppa['occur'] = '0';
    $wppa['start_album'] = '#last,0,3';
    $wppa['is_cover'] = '1';
    echo wppa_albums();
    ?>
    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    This is even simpler and more reliable:

    <?php
    echo do_shortcode( '[wppa type="cover" album="#last,0,3"][/wppa]' );
    ?>

    Thread Starter smazzoni

    (@smazzoni)

    It worked perfectly Jacob, thank you very much.

    Since I see you’re the plug in author I’d like to ask you about another problem I’m facing on my template. When I paste on a page (/photo-albums/) your basic shortcode [wppa][/wppa] two problems are coming:

    1 – Photo albums list are duplicated. I’ve paginated every 25 albums.
    2 – CSS code are breaking the layout. Basically, the problem is here:

    <div class=”index-post-content”>
    <p><span id=”bc-pname-1″ class=”wppa-nav-text b3″ title=”Page:
    <!– Start WPPA+ generated code –>
    <div id=” wppa-container-1″=”” style=”width:640px; padding:0;”>
    <input id=”wppa-nonce” name=”wppa-nonce” value=”5327636f37″ type=”hidden”>
    <script type=”text/javascript”>
    wppaAutoColumnWidth[1] = false;
    wppaColWidth[1] = 640;
    wppaTopMoc = 1;
    wppaAspectRatio[1] = 0.75;
    wppaFullSize[1] = 640;
    wppaFullFrameDelta[1] = 0;
    wppaFilmStripLength[1] = 554;
    wppaThumbnailPitch[1] = 104;
    wppaFilmStripMargin[1] = 2;
    wppaFilmStripAreaDelta[1] = 98;
    wppaIsMini[1] = false;
    wppaSlideBlank[1] = false;
    wppaLightBox[1] = “xxx”;
    </script>

    Am I doing something wrong? I didn’t modify your CSS codes (only paginated on your settings).

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I do not understand your issues.

    1. do you use the template with the do_shortcode for the page with the [wppa][/wppa] shortcode also in the text?

    2. what is going wrong exactly? Can you supply the code snippet above inside backticks please?

    Thread Starter smazzoni

    (@smazzoni)

    No, I just created a new WordPress page and pasted the shortcode. It’s on a different template (I think by default WordPress uses page.php to process pages) so the do_shortcode aren’t being used there.

    First problem on the piece of code is

    <div class=”index-post-content”>
    <p><span id=”bc-pname-1″ class=”wppa-nav-text b3″ title=”Page:
    <!– Start WPPA+ generated code –>

    The title from the span is not closed so is breaking the template.

    Also after that I’ve found a missing =””

    <div id=” wppa-container-1″=”” style=”width:640px; padding:0;”>

    Thus not sure if this is affecting the template too.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I found an improperly escaped title attriobute. You have most likely a double quote in the page title.

    I patched it, de-activate, remove and re-install a new download of the plugin. Version on the settings page should be 5.4.02.002

    And try again.

    Thread Starter smazzoni

    (@smazzoni)

    Will I loose albums / DB if I do that?

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    No, of course not!!

    Thread Starter smazzoni

    (@smazzoni)

    Sorry, is still having the same problem

    Thread Starter smazzoni

    (@smazzoni)

    FYI, I’ve used this time the shortcode generator instead and it works fine, no more duplicated albums nor HTML problems.

    So this doesn’t worked for me:

    [wppa][/wppa]

    And this worked perfecly:

    %%wppa%%

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Strange… I still would like a live link.

    Thread Starter smazzoni

    (@smazzoni)

    Unfortunately I’m working on localhost, but I’ll try to trace this error and send more info to you. Thank you very much for your awesome support!

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    You have a conflicting plugin ( most likely a content formatting ) that has a content filter active that modifies the code generated by wppa+. That content filter runs at a priority >= 11.

    The rendering of shortcodes runs at priority 11.
    The rendering of %%wppa%% scripts runs at priority 1001 ( Table IX-A1.1 ).
    Try setting Table IX-A1.2 from 11 to 1001, then the shortcodes will run at priority 1001, i.e. later than the offending content filter ( hopefully ).

    It is STRONGLY recommended that you can use shortcodes, scripts ( %%wppa%% ) are depricated. Shortcodes ( [wppa] ) can do very much more.

    If you find the offending plugin, please tell me, so i can add it to the blacklist, and you will get a warning message on the Settings screen.

    Plugins should never modify ( i.e. reformat ) existing page content at a higher priority than 10.

    The reason that the template version works, is that the code generated there is not a part of the pagecontent that is modified by the content filters.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘List latest albums’ is closed to new replies.