kenbowen
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Trying to modify THE LOOP to create a TOC for a categoryThanks! Hope you’re having a great day.
Forum: Fixing WordPress
In reply to: Trying to modify THE LOOP to create a TOC for a categoryNot being argumentative, just confused. Here’s the select of what I see on the screen for WP_Query doc:
#Usage #Standard Loop <?php // The Query $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo '<ul>'; while ( $the_query->have_posts() ) { $the_query->the_post(); echo '<li>' . get_the_title() . '</li>'; } echo '</ul>'; } else { // no posts found } /* Restore original Post Data */ wp_reset_postdata(); Collapse full source code
I think it works because of the
if { } else { }
structure.
Cheers,
–KenForum: Fixing WordPress
In reply to: Trying to modify THE LOOP to create a TOC for a categorySadly, examining https://developer.www.ads-software.com/reference/classes/wp_query/ carefully, there is no ‘endif;’ to be found, because it is written in the ‘old’ PHP syntax: if { } else { }. I translated that to the “new” syntax following the model of Loop[2]. Notice that Loop[2] runs correctly, but does not contain the element ‘endif’. But clearly, I did something wrong: Copying the lines 6-18 from Standard Loop in Usage in https://developer.www.ads-software.com/reference/classes/wp_query/ gave me the behavior I desired — an unordered list of titles at the beginning.
Thanks!
Additionally, thanks for the backticks tip, and for fixing my original post.
Where on this page should I see the Code button? (I’m on FF right now, but can’t see it on Chrome either.)Forum: Fixing WordPress
In reply to: Modify THE LOOP to create a TOC for a categoryBad paste – will resubmit
Forum: Hacks
In reply to: Problem using wp_new_commentThanks bcworkz. It turned out that
include ‘../../../../wp-load.php’;
did the job.Forum: Fixing WordPress
In reply to: how to use query_posts in theme loop with no wp_query presentI hadn’t searched far enough. The following helped me out:
https://kav.in/wordpress-dropdown-menu-wp-nav-menu-css/Forum: Plugins
In reply to: [Plugin: WP Super Cache] Super Cache crashIt was 0.8.7. Yes, I’ve cleared the cache and things seem to be working ok. Thanks