Create a hierarchical loop at predefined markup requirements

I was able to figure it out myself, here is the code: <div id=”fullpage”> <?php //for each category, show 5 posts $cat_args=array( ‘orderby’ => ‘name’, ‘order’ => ‘desc’ ); $categories=get_categories($cat_args); foreach($categories as $category) { $args=array( ‘showposts’ => 5, ‘category__in’ => array($category->term_id), ); $posts=get_posts($args); if ($posts) { echo ‘<section class=”vertical-scrolling” data-anchor=”‘ . $category->name.'”>’; foreach($posts as $post) … Read more

wordpress ajax return 0

So, if you want it to fire on the front-end for both visitors users and logged-in users, you can do this: add_action( ‘wp_ajax_my_action’, ‘my_action_callback’ ); add_action( ‘wp_ajax_nopriv_my_action’, ‘my_action_callback’ ); Example add_action( ‘wp_ajax_GetPostMedia’, ‘GetPostMedia’ ); add_action( ‘wp_ajax_nopriv_GetPostMedia’, ‘GetPostMedia’ );

views How to load javascript on custom page template?

Use a conditional wrapper in the above callback, e.g.: function temp_enqueue_scripts() { if ( ! is_admin() ) { if ( ‘custom-page.php’ == get_page_template() ) { wp_enqueue_script( ‘jquery’ ); } } } add_action( ‘wp_enqueue_scripts’, ‘temp_enqueue_scripts’ );