Jump to content

Image field with featured flag


jsantari
 Share

Recommended Posts

If I create a structure like this for photo galleries is it possible to mark an image as featured so I could select images from any of the galleries to display in a featured area? It looks like images only have one additional value the description so it seems to me that this approach won't work.

/photos/gallery-1

/photos/gallery-2

/photos/gallery-3 etc.

Is it possible to do it this way in PW or do I need to look at using the one page per image approach?

Link to comment
Share on other sites

enable tags on image field..

use tag 'featured'

$images = $page->images->findTag('featured');

or get first an array of all images from the template gallery or whatever then run your findTag on that array

  • Like 3
Link to comment
Share on other sites

enable tags on image field..

use tag 'featured'

$images = $page->images->findTag('featured');

or get first an array of all images from the template gallery or whatever then run your findTag on that array

Aaah...Alternatively, reminds me of this thread

https://processwire.com/talk/topic/3865-image-tags/

See Soma's solution (and comments) on that thread.... Something like this..

$images = $pages->get('/photos/')->children("image.tags=featured");

@Macrura,

Thanks for the pointers! O0

Edited by kongondo
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...