Accessing Advanced Custom Fields with Repeater using jQuery instead of PHP

Assuming you registered or enqueued your jQuery script using wp_enqueue_scripts and assigned it a proper handle, this function will allow you access to the postage_prices fields in jQuery via a variable postagePricesArray.prices. You need to replace %YOUR_SCRIPT_HANDLE% with your jQuery script’s actual handle or this variable may not become accessible. function localize_postage_prices() { global $post; … Read more

Display multiple page contents under single page

This is really pretty trivial to implement. A few minutes with the Codex should solve the problem, really. $args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, ); $q = new WP_Query($args); if ($q->have_posts()) { while ($q->have_posts()) { $q->the_post(); the_title(); the_content(); } } Any additional markup and formatting (CSS), of course, is up to you.

WordPress: code structure

I find that very easily my views become cluttered with logic, e.g. null checks, email validation, and retrieving values from the post object. How would you separate this out in WordPress? Is there any sort of MVC framework? There is no clear separation enforced by WordPress and there is extremely wide range of styles and … Read more

Save output of the_content_rss into variable

the_content_rss() is deprecated. You should be using the_content_feed(), but that is a secondary problem. Both functions echo content. What you want is the get_* variant– get_the_content_feed(). That is a general rule, by the way, but not a 100% consistent one. Many functions starting with the_ will output content immediately and there tends to be a … Read more