Access methods in plugin template

Normally not (it depends on what part of the plugins code you want to use and how the plugin initializes itself in the context in which you want to do it), the main plugin files are loaded as part of the wordpress boot process and the convention is that they will load the other files … Read more

Using page template to fetch posts in page

You will want to use wp_query to query the database for the posts, which will be something like: <?php $blog_args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => ‘-1’, ‘order’ => ‘DESC’ ); $blog_query = new WP_Query($blog_args); while ( $blog_query->have_posts() ) { $blog_query->the_post(); echo ‘<a href=”‘.get_permalink().'”>’.get_the_title().'</a>’; } wp_reset_postdata(); ?> That will display all posts with just … Read more

Masonry layout within the loop

try this. i am not sure it would work for masonary layout or not. but it would give you an idea on how to make rows and columns within loop. if ($news->have_posts() ) : while ($news->have_posts() ) : $news->the_post(); //$value = $news->current_post; if($value % 3 == 0){ ?> <div class=”row”> echo “<div class=”col-lg-4″>”; <div class=”height … Read more

Pagination for div’s

You could accomplish something similar via custom javascript on the page. It would allow the user to move through the divs (five at a time) while remaining on the same page, similar to a carousel. The code would work something like this: Hide all of the divs by default (via css) On page load, loop … Read more

AJAX Not Working With WordPress Database properly

I think your problem is here: $like_the_post = intval( $_POST[‘like_the_post’] ); You’re relying on the user’s browser’s POST input to determine whether to increment or decrement the count. When a user quickly clicks the button, the AJAX call hasn’t yet completed and changed the form input from true to false (or whatever’s vice-versa). Additionally, this … Read more