Pat Armstrong
Forum Replies Created
-
Forum: Plugins
In reply to: [Event Organiser] [Plugin: Event Organiser] Get next reoccurrences only?Thanks for the heads-up on
pre_get_posts
. I’ve adjusted my code on this project and will use this in future instead ofquery_posts
.Forum: Plugins
In reply to: [Event Organiser] [Plugin: Event Organiser] Get next reoccurrences only?Never mind, solved my own problem! You can manipulate the query string on event taxonomy pages in the same way that you’d do it on any other archive page.
Event-Organiser-specific arguments are accepted and understood fine on these templates — I’m not sure why I thought they weren’t.
I’ve inserted the following code before the loop on
taxonomy-event-category.php
andtaxonomy-event-venue.php
, and it behaves as expected.global $query_string; // Newest events first, show events for next 12 weeks and last 12 months query_posts( $query_string . '&orderby=eventstart&order=DESC&event_start_before=+12 week&event_start_after=-12 month' );
Thanks again for all your work on the plugin –?easily the best WordPress Events plugin I’ve used.
Forum: Plugins
In reply to: [Event Organiser] [Plugin: Event Organiser] Get next reoccurrences only?Thanks!
'group_events_by' => 'series'
does exactly what I needed.Related followup question — is there any easy way to manipulate the query on event taxonomy pages (taxonomy-event-category.php, etc) with Event-Organiser-specific arguments? e.g. using
group_events_by
as you describe above, or a combination ofevent_start_after
&event_end_before
to limit an archive to, say, a year either side of today?Forum: Themes and Templates
In reply to: How can I get wp_list_pages separated by commasNot the OP, but just wanted to thank you for posting the code that you did –?helped me understand what Walkers are and how to use/customise them. Cheers!
Forum: Themes and Templates
In reply to: Customising the output of wp_list_categoriesSo I realise I’m just talking to myself here, but I solved my issue in the end and thought I would add these links here incase someone else comes across this thread wanting to do something similar.
I ended up extending
Walker_Category
and overwriting the default behaviour of thestart_el()
function that this class calls.These two posts were pretty key in helping me understand what a Walker is and how to extend/build on one:
https://scribu.net/wordpress/extending-the-category-walker.html
https://www.ads-software.com/support/topic/how-can-i-get-wp_list_pages-separated-by-commasForum: Themes and Templates
In reply to: Customising the output of wp_list_categoriesSo I’m getting part of the way there on my own – the following code in my theme’s
functions.php
file allows me to add an ID to every<li>
generated bywp_get_categories
(this is good enough for my purposes – doesn’t need to be on each<a>
element really):function add_id_from_slug($wp_list_categories) { $pattern = '/class=/'; $replacement = 'id="xx" class='; return preg_replace($pattern, $replacement, $wp_list_categories); } add_filter('wp_list_categories','add_id_from_slug');
The obvious problem with this code is that I need each ID to match the category slug, which I expected this code to do for me:
function add_id_from_slug($wp_list_categories) { $pattern = '/class=/'; $replacement = 'id="'.$category->slug.'" class='; return preg_replace($pattern, $replacement, $wp_list_categories); } add_filter('wp_list_categories','add_id_from_slug');
But this just adds an empty ID attribute to each
<li>
tag. Adding something like$id = $category->slug; $output .= ' id="'.$id.'"';
to
wp-includes/classes.php
directly works, but I obviously don’t want to touch the WP core files.Any tips?
Forum: Themes and Templates
In reply to: Firefox renders some posts incorrectly, seemingly at randomyeah, i know. it’s to make the text/image rollovers work. i feel a bit uneasy about it, but can’t think of a better, more standards-compliant way to do it yet…
Forum: Themes and Templates
In reply to: Firefox renders some posts incorrectly, seemingly at randomSorry to bump, but just in case anyone has any ideas? This still has me stumped.
I’m not sure if it’s the fault of my still-developing CSS skills or my possibly incorrect use of multiple loops on the page template…
Code for one of the affected pages is attached below, if it helps.
<?php get_header(); ?> <?php if (have_posts()) : ?> <div class="panelcontainer"> <?php while (have_posts()) : the_post(); ?> <div class="description full" <?php echo c2c_get_custom('Collection_Colour', 'style="background-color:#', ';"', '') ?> > <p><?php echo c2c_get_custom('Collection_Description', '', '', '') ?></p> </div> <div class="panel third" style="background-image:<?php echo c2c_get_custom('Collection_Image', 'url(', ')', 'none') ?> ;"> <h2><?php the_title(); ?><br /> <?php echo c2c_get_custom('Collection_Subtitle', '<span class="subtitle">', '</span>', '') ?></h2> </div> <div class="collectioncontents"> <?php the_content(); ?> <hr class="clear" /> <div class="panelcontainer"> <?php rewind_posts(); ?> <?php query_posts(c2c_get_custom('Collection_Cat_ID', 'cat=', '&showposts=-1', '')); /* Get posts from category named in Collection_Cat_ID custom field of Collection post. */ ?> <?php $posts = get_posts(c2c_get_custom('Collection_Cat_ID', 'category=', '&numberposts=-1&offset=0', '')); foreach ($posts as $post) : start_wp(); ?> <div class="singlework"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_author(); ?>: <?php the_title(); ?>"> <div class="off"> <img src="<?php echo c2c_get_custom('Work_Image', '', '', '') ?>" alt="<?php the_title(); ?>" /> </div> <div class="on"> <h3><?php the_author(); ?></h3> <h4><?php the_title(); ?></h4> </div> </a> </div> <?php endforeach; ?> </div> </div><!-- end collectioncontents --> <?php endwhile; ?> <?php else : ?> <div class="description full"> <p>Just press the Back button and everything will be fine.</p> </div> <div class="panel textpanel third"> <h2>Error 404<br /> <span class="subtitle">Page Not Found.</h2> </div> <div class="collectioncontents"> <div class="panelcontainer"> <p>Sorry, what you are looking for is not here.</p> </div> <!-- end panelcontainer --> </div><!-- end collectioncontents --> <?php endif; ?> </div><!-- end panelcontainer --> <?php get_footer(); ?>
Forum: Plugins
In reply to: Post-Image plugin misbehaving on pagesSorry, I’ve been moving things around a bit, and forgot about the links from here! The problem page is back there (at https://nexusproject.net.au/bios-only/) now.
I should have been clearer in explaining what I want to ultimately do:
– On a page, display the images for all posts from one category.
– And then, on the same page, display the images for all posts from another category.
I have put a workaround in place for the moment: since there is only one post in the first category, I have added it in manually on the Category Archive template (now called ‘shortfilms’):
https://nexusproject.net.au/shortfilms/
Since I’m dealing with posts from two categories, I can’t just set everything up in a Category Archive template (which plays nice with Post-Image), can I?