Post data across WordPress sites

You can use url parameters (read more here http://php.net/manual/en/reserved.variables.get.php) but of course you need to create a small function in jQuery / javascript to retrieves those. For instance, placing a link like https://www.websiteb.com?country=yourcountry in your Website A and using a get_url_param(country) jQuery function in your Website B, you could pass the value to the AJAX … Read more

Sorting post by custom field and category

If you are on a category page (that is at URL like https://example.com/cateogry/test/ and want to filter your query by “test” category) then you can modify your code to this global $wp_query; $query = new WP_Query( array( ‘meta_key’ => ‘date_event’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘advert_category’, ‘field’ => … Read more

Sync All Post Type Tag

If you want to auto-create the same term in another taxonomy, the following code should do it: You’ll add the code to the theme functions file (i.e. functions.php), and make sure to change the $taxonomies which is the list of the applicable taxonomy slugs — the taxonomies that you wish to “sync”. Both the $taxonomies … Read more

Administrator Posts

You can possibly try the following: Install ACF plugin and can create a front end page to edit any posts. (I have done this) Next, write a code to make sure that the post is not authored by the administrator. (I didnt try this out yet)

New Post bubble

<?php if( date(‘U’) – get_the_time(‘U’, $post->ID) < 24*60*60 ) : ?> <div class=”bubble”><?php _e(‘NEW’, ‘mytheme_name’); ?></div> <?php endif; ?> the above one will show NEW div for each post posted in 24 hours. You can simply add anywhere in your posts loop. You can use 7 * 24 * 60 * 60 to make it … Read more

how to make special modal for each post

Yes it is possible. I think you are using bootstrap modal. And it is looks like this: Bootstrap Modal <!– Button trigger modal –> <button type=”button” class=”btn btn-primary” data-toggle=”modal” data-target=”#exampleModal”> Launch demo modal </button> <!– Modal –> <div class=”modal fade” id=”exampleModal” tabindex=”-1″ role=”dialog” aria-labelledby=”exampleModalLabel” aria-hidden=”true”> <div class=”modal-dialog” role=”document”> <div class=”modal-content”> <div class=”modal-header”> <h5 class=”modal-title” id=”exampleModalLabel”>Modal … Read more

Get post by two meta key but order by one of them

use ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘post_views’, ‘order’ => ‘DESC’, instead of ‘orderby’ => array( ‘post_views’ => ‘DESC’, ), your way is okay for string, but when you use number it is better to use meta_value_num meta_value will sort number weird 1, 3, 34, 4, 56, 6, etc, rather than 1, 3, 4, 6, 34, … Read more