surfsup74
Forum Replies Created
-
Forum: Plugins
In reply to: [Media Library Assistant] Images assigned multiple tagsThanks so much for taking the time to consider my question. I have managed to work something out that means I no longer need to switch plugins.
I just needed to restrict the nav on the attachment page to pages within the term from which I had visited.
Forum: Plugins
In reply to: [Media Tags] Attachment page navigation according to media tagForum: Plugins
In reply to: Remember taxonomy term and use it to restrict subsequent attachment page navI have solved this now.
I used this to get the last part of the url (the taxonomy term)
$url = $_SERVER['REQUEST_URI']; $url = trim($url, '/'); $array = explode('/',$url); $the_taxterm = end($array); echo $the_taxterm;
Then this to store it.
session_start(); $_SESSION['the_taxterm'] = $the_taxterm; echo $the_taxterm;
And this to use it in the image template
session_start(); $the_taxterm = $_SESSION['the_taxterm']; echo $the_taxterm;
I didn’t need to worry about the expire bit as it seemed to expire / refresh anyway.
Forum: Fixing WordPress
In reply to: Some (but not all) images are not showing.Found the problem – I had previously named another field and the loop wa pulling in images for that field name! All sorted.
Forum: Fixing WordPress
In reply to: Some (but not all) images are not showing.*Update*
I have noticed (by chance) that if I put the same loop into my template file used to display ‘taxonomy’ pages it then outputs all the images as I want. However – if I use the same loop on my template file for ‘pages’ (which is where I need it) it will only display some (but not all) images.
Weird, but I expect there’s a simple explanation?
Thanks,
Forum: Plugins
In reply to: [Taxonomy Images] I want to add Taxonomy Image to Media-Tags pageI got this working (‘image_tag’ is the name of the custom field used to add an image):
$types[0] = 'media-tags'; foreach ($types as $type) { $terms = get_terms($type, array('name_like' => "a", 'order' => 'ASC', 'orderby' => 'name', 'exclude' => '26') ); if ($terms) { foreach($terms as $term) { $image = wp_get_attachment_image_src(get_field('image_tag', 'media-tags_'.$term->term_id.''), 'thumbnail'); echo '<li><h2><a href="/'.$term->slug.'">'.$term->name.'</a></h2>'; echo '<img src="'.$image[0].'"/></li>'; } } }
Feel free to improve on this.
Forum: Plugins
In reply to: [Taxonomy Images] I want to add Taxonomy Image to Media-Tags pageDoes this help with regards to your previous post; https://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/
Forum: Plugins
In reply to: [Taxonomy Images] I want to add Taxonomy Image to Media-Tags pageI’ve cobbled this together ??
<?php $types[0] = 'media-tags'; $image = wp_get_attachment_image_src(get_field('image_tag', 'media-tags'), 'thumbnail'); foreach ($types as $type) { $terms = get_terms( $type, '' ); if ($terms) { foreach($terms as $term) { echo '<h2>'.$term->name.'</h2>'; echo '<img src="'.$image[0].'"/>'; } } } ?>
It doesn’t get me the correct image though -it just displays the term name (correct) and the most recent image I’ve added to the site (not what I want). I need to get the image that’s been selected in the Edit Media tags page.
I really would love to get this thing working…
Thanks
Forum: Plugins
In reply to: [Taxonomy Images] I want to add Taxonomy Image to Media-Tags pageI need to be able to select an image from the media library as I want to display my best photo to represent each ‘term’ so random would not work for me.
I have had a play with the Advanced Custom Fields plugin and have added a ‘select image’ field to the ‘term’ management (Edit media tag) page – so now there are 4 fields; 1/ Name, 2/ Slug, 3/ Description, 4/ Add image.
The problem is that I don’t know how to grab the term’s name and associated image form the database. Any code suggestions would be very welcome! I’ll try myself anyhow and post any working code here…
The ACF plugin is well documented. Stuff about ACF taxonomies can be found here.
Thanks.
z.green, I don’t see that option. When I click on the tag (I’m going: ‘Media’ > ‘Media tags’ > ‘Specific tag name’) the only fields are ‘Name’, ‘Slug’ & ‘Description’. It would be great to be able to add the ‘Featured image’ field here. Did anyone figure this out yet?
Forum: Plugins
In reply to: [Media Tags] Order of attachmentsYes sir – that worked! Thanks
Forum: Fixing WordPress
In reply to: Output the image's filename onlyPerfect. Thanks wpismypuppet.
Forum: Fixing WordPress
In reply to: Output the image's filename onlyHi wpismypuppet,
I can get the url using
<?php echo $image[0]; ?>
as in the code below. However, how do I combine that with your suggestion in order to put just the filename in place of ‘XXXX’ in my code below?<?php // start advanced custom fields repeater if(get_field('images')): ?> <?php while(the_repeater_field('images')): ?><?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?> <a href="<?php echo $image[0]; ?>" rel="shadowbox[set]" title="Click to view this photograph fullscreen. Filename: XXXX" > <img src="<?php echo $image[0]; ?>" width="678" /></a> <?php endwhile; ?> <?php endif; ?>
Forum: Fixing WordPress
In reply to: Help to get parent post slugOK – I now have…
<?php function the_parent_slug() {
global $post;
if($post->post_parent == 0) return ”;
$post_data = get_post($post->post_parent);
return $post_data->post_name;
} ?>
<?php $the_parent_slug = the_parent_slug(); ?>
<?php $media_items = get_attachments_by_media_tags(‘size=thumb&media_tags=’.$the_parent_slug); ?>…but still get nothing in the $media_items parameters. Where am I going wrong here?
Forum: Fixing WordPress
In reply to: Get a list of all the post associated with an attachmentOk – thanks for the heads up. I can now move on.