Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter mmachine

    (@mmachine)

    Ok, so I completely overlooked this from the PHP docs:

    ‘W’ | ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)

    …which means there IS a much simpler way of doing this:

    $post_date = get_the_date();
    // Stringify the post dates
    $post_date = strtotime($post_date);
    // Declare first date in the query range
    $week_number = (int)date('W', $post_date);
    $year_number = (int)date('Y', $post_date);
    $post_query = 'w='.$week_number.'&year='.$year_number;
    query_posts($post_query);
    Thread Starter mmachine

    (@mmachine)

    I actually just found the problem though on my own. What happened is I’d removed the wp_enqueue_script() function from my header a few days ago during some testing and forgotten to add it back. This whole time I was trying to narrow down the problem to a comment ID or div ID declaration conflict, when it didn’t even occur to me to actually check that I had the library loaded in the first place.

    Anyway, Esmi — appreciate the info! Probably would have found it through there sooner or later if I hadn’t gotten wise.

    Thread Starter mmachine

    (@mmachine)

    keesiemeijer, thanks! This didn’t solve my problem, but it’s actually a pagination technique I could definitely use.

    As to what did solve my problem, it was having to do with the page URL being the same as the custom post name. So, my page was ‘/television/’, and my custom post type is ‘television’, so WordPress wasn’t letting me go past the first page. Confusing, because if I try viewing /television/ by itself, there’s no default rendering or the custom post types, so I’m not exactly sure what call WordPress is protecting.

    Thread Starter mmachine

    (@mmachine)

    esmi, thanks! feel like an idiot — totally read over that yesterday before I posted this question.

    t31os_, looks like you’re right. After some more troubleshooting, I’m pretty certain WordPress just pulls the closest-sized image based on the dimensions in that array. The reason you need to be careful though is that with (potential) multiple image sizes, it sometimes pulls the wrong image, so you have to do a lot of cross-referencing and troubleshooting with your WP Media settings, the post thumbnail designation, and your template code. Bottom line, there’s several places where things can break, giving some unexpected results.

    Anyway, thanks again for the answers. They’ve been super helpful!

    Aeox — thanks for posting that code! Helped me start to solve a problem I’m having, but I’m getting some unpredictable results. Sometimes the proper post-associated thumbnail image is pulled, but other times the post gets the default 150×150 pulled instead.

    Can you elaborate a bit more on the context of the array() argument in the get_attachment() function? In other words, does it look for a thumbnail sized to the specified dimensions (as put into the array), or does that array tell WordPress the dimensions at which to render the pulled image?

    Thanks!

    Hmm, nope! Your input is definitely putting me on the right track, but it still looks like that call is still referencing the legacy WordPress thumbnail data. I’ll do some digging of my own and try to see what’s going on.

    I did find this snippet that sheds a bit of light, but I’m still having unpredictable results with the thumbnail its returning. Sometimes it pulls the properly-sized image I’m looking for, sometimes it pulls the default 150×150.

    <?php wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 60,60 ), false, '' ); ?>

    Sorry for derailing by the way, but t31os_ you’ve been a huge help! Thanks!

    Almost there! This one did pull a resized thumbnail, but the wrong one. It’s pulling the WP 150×150 standard.

    Fortunately I think my design accommodates for just resizing this one, but what I’m actually I’m looking to get the one designated by the user upon post, as supported by this function — https://codex.www.ads-software.com/Template_Tags/the_post_thumbnail . With this function you have the option of calling various sizes, but I can’t seem to find out if it’s possible to grab those same size variations using the get_attachment method?

    t31os_, I tried this as a workaround to an issue I was having — https://www.ads-software.com/support/topic/400895?replies=1 — and while it worked for pulling the image, it pulls the full image size instead of the optimized, thumbnail resized version that the_post_thumbnail() does.

    How would you access the WordPress-resized thumbnail variations with this?

    Thread Starter mmachine

    (@mmachine)

    Figured this out by using this code to build my query:

    <?php
    $args=array(
    ‘showposts’=>10,
    ‘tag__not_in’ => array(‘4′,’6’),
    );
    query_posts($args); ?>

    I was too dead-set on basing the query on the NAMES of my tags that I neglected a method based on the IDs.

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