ariimage
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Calling Title as Category in arrayAfter an afternoon of searching I found this
<?php echo '<div id="links" class="photographer-gallery">'; <strong> // This replaces any spaces in the title with dashes $title_slug = strtolower(str_replace( " ", "-" , the_title_attribute('echo=0') ) ); </strong> $args = array( 'post_type' => 'attachment', <strong>'category_name' => $title_slug,</strong> 'numberposts' => -1, 'order' => 'rand', 'post_status' => null, 'post_parent' => null, // any parent ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $post) { setup_postdata($post); the_attachment_link($post->ID, false); } } echo '</div>'; ?>[Moderator Note: Please post code & markup between backticks (not single quotes) or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Hope others find this usefull.
Forum: Fixing WordPress
In reply to: Calling Title as Category in arrayPs you can see what I am working on.
Forum: Fixing WordPress
In reply to: Page Template Not showing upFixed it. But cannot remember to post here and close topic.
Forum: Fixing WordPress
In reply to: WordPress category_name array for archiveIm attempting something similar.
$cat = array WP_Query('category_name='.wp_title()); $args = array( 'post_type' => 'attachment', 'category_name' => $cat, 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, // any parent ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $post) { // setup_postdata($post); the_attachment_link($post->ID, false); // the_excerpt(); } }[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
I am trying to get media and whittle it down to images for a category based on title.
So if on the custom post for tony-irvine and media is category tony-irvine it shows only this and not any other media.