Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • You don’t need this plugin to do this. Just create a style in your style.css file for the color. Something like this:

    (as widgets traditionally appear in <li> tags)

    #sidebar li {
    color: #0a72bf;
    }

    Change #sidebar to match the ID of your sidebar (which is often just called #sidebar anyways). If your widgets aren’t in </li> tags, change that to whatever you put them in.

    Hope that helps.

    Thread Starter candlebain

    (@candlebain)

    Still not getting anything. To simplify, I changed the category name to Rock, and I’ve tried both upper and lowercase with no results.

    Are media files associated with the posts they are attached to as well as the groups assigned to the post? The only theory I have is that media files don’t inherit the category tags of their parent posts.

    For reference, I have two test posts in the Rock category that each have a pdf attachment. They only show when I remove the category sort, but then I get the whole site’s attachments.

    In case my code is faulty, here’s the code I’m using:

    <?php
    $args = array(
    'post_type' => 'attachment',
    'category_name' => 'Rock', // The title of the category
    'numberposts' => -1,
    'post_status' => null,
    'post_parent' => null
    );
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $post) {
    		setup_postdata($post);
    		the_title();
    		the_attachment_link($post->ID, false);
    		the_excerpt();
    	}
    }
    ?>

    Thanks for sticking with me on this. I appreciate the help.

    Forum: Themes and Templates
    In reply to: e() function

    Why not use echo, the typical PHP function?

    Plus, if this is non-dynamic HTML, it makes more sense to me to build it into your code as standard code rather than PHP generated.

    Thread Starter candlebain

    (@candlebain)

    Here’s something else I’ve tried:

    <?php
    	$args = array(
    				'post_type' => 'attachment',
    				'post_mime_type' => 'application/pdf'
    			);
    	$pdfs =& get_children($args);
    	print_r($pdfs);
    	foreach ( (array) $pdfs as $attachment_id => $attachment ) {
    		echo wp_get_attachment_link( $attachment_id );
    	}
    ?>

    It’s not recognizing my MIME type. I was hoping this would let me sort into categories once I found the links…

    Ugh.

    A thought:

    ‘#searchform input’ has more specificity than ‘#searchsubmit’

    That means for any input tags (which the submit button is), rules in ‘#searchform input’ take precedence.

    Try this:
    ‘input#searchsubmit’ instead.

    Paste in some of the html code related to the search button. You probably have a specificity conflict or something related.

    Are you styling the ‘input’ tag below it in the css, or with more specificity? That could cause all sorts of issues.

    Thread Starter candlebain

    (@candlebain)

    Is it possible the slug is only associated with the text? Or is it associated with the media as well?

    Any idea how I might do this?

    Thread Starter candlebain

    (@candlebain)

    Any tips on getting this to work though? Am I using it wrong?

    I actually need the attachments in a single page as a repository for attachments from all posts related to a class. I don’t need to post text on this page. I’m just trying to pull all attachments from only the College Class category into a single page. Instead, I’m either getting every attachment from every category, or nothing at all.

    Thread Starter candlebain

    (@candlebain)

    Ok…after playing with this for awhile, I’m not getting anything working. Admittedly, this is a bit further into PHP than I thought I was going to get with this.

    I stumbled on get_posts(), which might work as well…here’s what I’m using:

    <?php
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => -1,
    	'post_status' => null,
    	'post_parent' => null // any parent
    	);
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $post) {
    		setup_postdata($post); ?>
    		<p><?php the_attachment_link($post->ID, false); ?><p>
    <?php	}
    }
    ?>

    First off…is this even viable? When I run it like it is, I get all my attachments, site-wide. It claims I can limit by category by using ‘category_name’, but when I do this, I get nothing. I’ve tried the slug and the actual category title, and several variations out of frustration.

    When I tried category_name, here’s how I did it:

    Everything was the same except for $args:

    $args = array(
    	'post_type' => 'attachment',
    	'category_name' => 'rock-history-night', // The slug for the category
    	'numberposts' => -1,
    	'post_status' => null,
    	'post_parent' => null // any parent
    	);

    Everything disappears…no results. What do you guys think?

    Thanks

    Thread Starter candlebain

    (@candlebain)

    I see how that works. Thanks for the link!

    Couple questions:

    Will this work for .doc files as well? I didn’t see it in the WP mime types.

    How would you go about separating the attachments by College Class? I plan to use a Category for each College Class (seems logical right now anyways), but I also want each Class on its own page.

    Thanks for the help.

Viewing 10 replies - 1 through 10 (of 10 total)