What’s the equivalent of Hide From Menus on MODX on WordPress?

You can create a Custom Field radio button called hide_from_menus with values yes or no t then use Query posts by custom fields. Then in your query, add meta_key and meta_value. Example: $args=array( ‘post_type’ => custom-post-type, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘hide_from_menus’, ‘meta_value’ => ‘yes’ ); Be sure though that you update … Read more

First custom field value (out of several) displayed twice after query

I managed to fix it! As I suspected it had nothing to do with the code relating to $number, but rather the echo call before it. My initial code looked like this (I’m skipping part of the loop content to keep it simple): echo ‘<p style=”color:grey;font-size:11px;margin:0;”>(‘ . $number = intval(get_post_meta(get_the_ID(), ‘number’, true)); if($number > 1){ … Read more

How to fix pagination for custom loops?

The Problem By default, in any given context, WordPress uses the main query to determine pagination. The main query object is stored in the $wp_query global, which is also used to output the main query loop: if ( have_posts() ) : while ( have_posts() ) : the_post(); When you use a custom query, you create … Read more

cache specific data?

This is probably not the most optimal solution, but you could store static metadata as an array in the theme options. The options table is loaded in memory by default, giving you fast access.