MrJLC
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Custom Post Type, Custom Taxonomy Rewrite Rules ArrayThanks for your reply. Yeah, thats what I am finding, its one rewrite rule or the other, not both together, at least for custom post types and taxonomies.
Forum: Developing with WordPress
In reply to: Custom Post Type, Custom Taxonomy Rewrite Rules ArrayI have also tried running is_single() within the rewrite function but seems that its not available when the rewrite_rules_array is run. If it was available, then I could just check the last segment of the permalink if its on a single (product) page and use the appropriate rewrite rules, else use the rewrite rules as we are on a taxonomy (child category) page.
Forum: Developing with WordPress
In reply to: Custom Post Type, Custom Taxonomy Rewrite Rules Arraypls ignore this line of code:
$last = count($parts)-2;
- This reply was modified 3 years, 8 months ago by Jan Dembowski.
Forum: Plugins
In reply to: [WP-dTree] Custom post typesHi, just to resurrect this thread – is there anyway I can use this plugin in conjunction with WCK Custom Taxonomies (https://www.ads-software.com/extend/plugins/custom-taxonomy-creator/) ?
Because when I use your widget ‘wpd-tree taxonomies (beta), the select list ‘show descendants of’ is empty and the next select list ‘only direct children of’ only contains 1 option which is ‘root (0)’.
Any info much appreciated
Forum: Fixing WordPress
In reply to: WP_Query Group By Help!Just an update, I managed to get the results I wanted by doing a double WP_QUERY:
function getResults() {
//first, lets get all the items within the ‘groceries’ section, regardless of what type of product they are
$args = array(
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
‘paged’ => $paged,
‘posts_per_page’ => ‘-1’,
‘meta_query’ => array(array(‘key’ => ‘section’,’value’ => ‘Groceries’,’compare’ => ‘LIKE’)),
);$link = new WP_Query($args);
$types = array ();
//loop through all the products and populate the ‘types’ array
while($link->have_posts()) : $link->the_post();
$type = get_field(‘type’);
$types[] = $type;
endwhile;//strip out the duplicates
$result = array_unique($types);//now loop through the size of the ‘types’ array, running a fresh query, but this time, filtering the results by ‘type’
foreach ($result as $value) {
$args = array(
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
‘paged’ => $paged,
‘posts_per_page’ => ‘-1’,
‘meta_query’ => array(array(‘key’ => ‘type’,’value’ => $value,’compare’ => ‘LIKE’),array(‘key’ => ‘section’,’value’ => ‘Groceries’,’compare’ => ‘LIKE’)),
);$link = new WP_Query($args);
//display the title based on the type of product we are showing
echo ‘<h2>’.$value.'</h2>’;
// the include file is a neatly formatted table that loops through all the matching types of products.
include (“include_results_table.php”);
}
}
add_shortcode(‘getResults’,’getResults’);So, it works at least. Perhaps not the most efficient method, but the script wont be handling massive amounts of data.
But if anyone has a cleaner/simpler approach, feel free to post ??
Forum: Fixing WordPress
In reply to: WP_Query Group By Help!Yeah, Ive already tried the custom field within WP_Query, but cant seem to fathom that method out to get the results I want. Since creating this thread, Ive done a bit more searching and found this within the codex:
https://codex.www.ads-software.com/Displaying_Posts_Using_a_Custom_Select_Query
Havnt tried it yet, but will do soon. Hopefully it will work out(!)
Thanks for the information.
Did you have to make any changes to:
function generate_fancy() {
within the file generator.php ?
For example, in function generate_fancy() Ive added this:
‘archive-image’ => “<img src='”.$thumbnail.”‘ border=’0’>”,and fancy.html, made this change:
<ul class=”archive-list”>
<h2>{{{archive-image}}} {{{post-list}}}</h2>However, no image is showing up, so I guess the variable $thumbnail is not applicable in this scenario as when I view the HTML page, I can see <img src=” border=’0′>
Forum: Themes and Templates
In reply to: Change Page Template on-the-fly ?Im thinking it may have something to do with:
locate_template($template_names, $load = false, $require_once = true )
or get_template()?