Forum Replies Created

Viewing 3 replies - 46 through 48 (of 48 total)
  • Thread Starter mike.chiv

    (@mikechiv)

    Okay nevermind, I figured it out. I had an existing php file called “league-table.php” that the league table was drawing from for some reason (the guide says that the file should be called “single-table.php”, right?). I removed that file and boom, everything worked fine.

    Just in case anyone reads this having had the same issue, the_content() was in fact the correct way to insert the table. I was wrong to doubt myself.

    Anyway, plugin seems excellent so far. Thanks team! ??

    Thread Starter mike.chiv

    (@mikechiv)

    …and then three minutes later I found the cause!

    It was my fault. Some JS I have that affects the main menu, i.e. another nav was targetting <i>all</i> nav elements.

    Sorry for time-wasting!

    Thread Starter mike.chiv

    (@mikechiv)

    Never mind! I fixed it after a load of research and trial and error.

    As each product page used the same category, I was able to create an array of these pages, then create another array of the exploded values for “category” from each page using nested foreach loops.

    I then used the function, “array_unique” to remove duplicates from the list. Please excuse the simplistic explanation as well as code, I wrote it for people like myself who need the extra detail!

    <?php
    $pages = get_posts(array(
    		'post_type' => 'page',
    		'meta_key' => '_wp_page_template',
    		'meta_value' => 'product.php'
    ));
    
    $catlist = array();
    
    foreach($pages as $page){
    $categories = get_post_meta($page->ID, 'categories', true);
    $categories = explode(',' , $categories);
    	foreach($categories as $category){
    			$catlist[] = $category;
    	}
    } 
    
    $unique_catlist = array_unique($catlist);
    
    ?>
Viewing 3 replies - 46 through 48 (of 48 total)