Latest photo – latest album
-
Hello!
is there a way to add a random photo from the latest added album with php, like
<?php echo wppa_albums(); ?>
Thank for help.
-
To make it a bit more simple, i added a new function to the code. This function will remain in future versions. To use it now, update to the current development version 6.6.07.002, See: http://wppa.nl/docs-by-subject/development-version/ for instructions.
After that, put in the page template:
<?php if ( function_exists( 'wppa_get_random_photo_id_from_youngest_album' ) ) { $photo = wppa_get_random_photo_id_from_youngest_album(); if ( $photo ) { echo wppa_insert_shortcode_output( do_shortcode( '[wppa type="photo" photo="' . $photo . '"][/wppa]' ) ); } } ?>
This will do the job. If the youngest album does not have any photos, it will use the previous youngest album, etc.
You can change the shortcode
[wppa type="photo" photo="' . $photo . '"][/wppa]
as you like ( add optionalsize="..."
andalign="..."
as you like, or e.g. changetype="photo"
intotype="mphoto"
) as long as you keepphoto="' . $photo . '"
intact.For more shortcode options see: http://wppa.nl/shortcode-reference/
- This reply was modified 7 years, 4 months ago by Jacob N. Breetvelt. Reason: fixed typo
Thanks, will check it ASAP.
I am trying to work this out to make the photo to be a link to the album itself. I tried the generator, but with no results. Any hints? 🙂
If you have
type="photo"
in the shortcode, set the linktype in Table VI-B3a
If you havetype="mphoto"
in the shortcode, set the linktype in Table VI-B4a
If you havetype="xphoto"
in the shortcode, set the linktype in Table VI-B4.1a
and select – on the same line – a landing page where to display it. A landing page must have a wppa shorrtcode ( preferrably:[wppa type="landing"][/wppa]
) in its content.- This reply was modified 7 years, 4 months ago by Jacob N. Breetvelt.
I did change the link type, made the anding page, but still the image is not linked.Tried with single photo, mphoto etc.
Can you give me a link to the page, a screenshot of Table VI-B and the shortcode you use?
http://www.bonjovi.pl/galeria/
https://www.dropbox.com/s/bcdijukh9vgmuq8/Schowek02.jpg?dl=0
<?php if ( function_exists( 'wppa_get_random_photo_id_from_youngest_album' ) ) { $photo = wppa_get_random_photo_id_from_youngest_album(); if ( $photo ) { echo wppa_insert_shortcode_output( do_shortcode( '[wppa type="mphoto" photo="' . $photo . '" size="250" align="right"][/wppa]' ) ); } } ?>
It gives a link in the code, but it is not clickable. Maybe it can’t be a self landing page?
There is a second item on top of the first. Add
<div style="clear:both" ></div>
as follows:<?php if ( function_exists( 'wppa_get_random_photo_id_from_youngest_album' ) ) { $photo = wppa_get_random_photo_id_from_youngest_album(); if ( $photo ) { echo wppa_insert_shortcode_output( do_shortcode( '[wppa type="mphoto" photo="' . $photo . '" size="250" align="right"][/wppa]' ) ); echo '<div style="clear:both;" ></div>'; } } ?>
- This reply was modified 7 years, 4 months ago by Jacob N. Breetvelt.
- This reply was modified 7 years, 4 months ago by Jacob N. Breetvelt.
Works fine, but the cursor in not the hand pointer, can I edit it somewhere in css?
Also, is there a way to get the last modified category name?
the cursor in not the hand pointer
This is a bug that will be fixed in the next version. Thanx for noticing.
is there a way to get the last modified category name
No, there is not.
Fixed 6.6.08
- The topic ‘Latest photo – latest album’ is closed to new replies.