Показаны сообщения с ярлыком wordpress. Показать все сообщения
Показаны сообщения с ярлыком wordpress. Показать все сообщения

вторник, 4 декабря 2018 г.

Enable GZIP in WHM

I was looking for this simple solution to my problem, that even when mod_deflate is enabled, GZIP compression was not working.
So finally the simple thing to do in WHM was to check this checkbox in

Multi PHP INI editor (choose php version)
and get this checked - zlib.output_compression


enable gzip in whm


Must check that in Apache you already enabled mod_deflate - in easy apache.


среда, 2 ноября 2016 г.

AJAX IN WORDPRESS - Simple Example - 2 steps!

No more words needed to explain it.
I made a best simple solution - without any plugin!

Take it and use this simple code.
* Please share and like.


YOURACTION_NAME - 3 places to update
POST_VAR_1  (optional) - 2 place to update

1. JS

jQuery(document).ready( function($) {

  $.ajax({
        url: "/wp-admin/admin-ajax.php",
        data: { action:'YOURACTION_NAME', POST_VAR_1 : 1 },
        type: 'POST',
success: function( data ) {
alert( data ); // do whatever you want
}
})

});



2. ADD TO FUNCTIONS.PHP


function implement_ajax() {
if(isset($_POST['POST_VAR_1']))
{
 echo  ' DATA IS '. time();  // send whatever you need
die();
}
}
add_action('wp_ajax_YOURACTION_NAME', 'implement_ajax');
add_action('wp_ajax_nopriv_YOURACTION_NAME', 'implement_ajax');  //for users that are not logged in.

вторник, 3 февраля 2015 г.

WORDPRESS post_type tribe_events orderby

After a long seeking and learning (and I am not wp expert), I found an ultimate solution for this Modern Tribe plugin.
The problem is, that the plugin wants you to use their function to get the posts, but what if you want to have the post inside the main query - this enables you to use the have_posts().
And when you try to set your orderby for that query - it doesn't change.

So, here is the best solution you will find all over the net -
You should update the main class function in lib/tribe-event-query.class.php:
somewhere in line 619, there is a switch for the orderby arg, add your custom case to that switch for example:

case 'EventStartDate':
     $order_sql = "EventRating ASC, " . $order_sql;
break;


Then your
query_posts(array('post_type'=> 'tribe_events','orderby' => 'EventRating',  .....

WILL FINALLY WORK