Blog Image and Title in Right Sidebar

I think it’s easier to put the css code inside your theme through customize theme. wp-admin > appearance > customize To create a css that affects your sidebar posts like you want you need to post the html structure.

PHP code printed into CSS classes

Well, previous developer was a little bit naughty (;)) and used PHP short tags, which is a bad practice… And even worse – he used them a little bit wrong, I guess… As you can see, there is something like this in your code: style=”<?print implode(‘;’,$styles); ?>”> Of course there is no such thing like … Read more

Obtain wordpress user role

I wanted the logged in user to get one form from other application only if he/she is Administrator and here is how I checked it. You can check for any role (even new role made through custom user role). <? require($_SERVER[‘DOCUMENT_ROOT’].’/wp-load.php’); //to load from any folder $current_user = wp_get_current_user(); $user_info = get_userdata($current_user->ID); if (in_array(“administrator”, $user_info->roles)) … Read more

Pass product object to javscript

Just change wp_localize_script( ‘load_product_info’ , ‘products’ , $gg_products); with (EDITED ->wp_localize_script() accepts an array as 3rd par.) wp_localize_script( ‘load_product_info’ , ‘products’ , array(‘current_products’=>json_encode($gg_products ) ) ); transforming the php object into a json string and building an array . Then in the js file convert the string into a js object with JSON.parse function load_product_info() … Read more