Articles of functions

Slider Thumbnail Size Issue

My website features a slider on the front page and i’m having issues with the uniformity of its thumbnail sizes. Please, help me out.The slider thumbnail size in the function.php is 600*400. The left most thumbnail is true to the code. But the other two aren’t.

Function not working on any file other than the main plugin file

My plugin has several php files that are included on the main plugin file. I am using some functions on the other files but they don’t work there. They work when I use them on the main plugin file. For example, On the main plugin file “test-plugin.php” <?php /* Plugin Name: Test Plugin Description: test […]

write in .json file

I created a function that retrieves my post event type, and converted to json format. add_action( ‘wp_ajax_events_ajax’, ‘events_ajax’ ); add_action( ‘wp_ajax_nopriv_events_ajax’, ‘events_ajax’ ); function events_ajax() { $offset = $_POST[‘offset’]; $args = array( ‘post_type’ => ‘events’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘wpsc_start_date’, ‘offset’ => $offset ); $loop = new WP_Query($args); $array = array(); […]

Rest API User Levels

I’ve got a a mobile angularjs app that’s using jwt auth to add to WP_Rest API which works fine, when a user is an Administrator. However, when an editor tries to login I get the error; code : “rest_user_cannot_view” data : {status: 401} message : “Sorry, you cannot view this resource.” I can’t […]

Could you please correct the code is_admin()

I have this code in my function.php: add_action( ‘init’, ‘blockusers_init’ ); function blockusers_init() { if ( is_admin() && ! current_user_can( ‘administrator’ ) && ! ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) { wp_redirect( ‘’, 302); exit; } } But I want ‘moderator’ to reach the admin-panel. What should I add to the code? Thank […]

Setting Active Nav item (of Pages) when you are on a Post with Category

I am working on my first WordPress custom theme and I now have a problem. I’ve organized the site such that I’m using a front-page.php as my home page that shows a long page with some links. These links go to other Pages. Let’s call these T1s. On those pages, I have a long page […]

Css loads very slow

I have already searched about the problem but I didn’t find something i understand, specifically for WordPress. Should I edit function.php of my theme somehow? When the site loads the ugly sitemap appears and after a moment the site appears correctly. I already fixed (only) the CSS errors seen in console and minified a big […]

Get title from IDs in a string

Im trying to get titles from IDs in string, but I’m getting stucked when I want to use get_the_title() function and receving error implode(): Invalid arguments passed $act_name = explode(‘,’, $unserialized[‘_gravity_form_lead’][‘9’]); $titles = implode(‘, ‘, get_the_title($act_name)); where $unserialized[‘_gravity_form_lead’][‘9’] returns string like 3115,3116 any ideas?

How to hide the author box of a specific user?

I am running a news website, most of the posts are from an Editor Account. I want to hide the author-box displaying at the bottom of the posts, only for this user. Only author box of Editor should be hidden from public. Is there any way to hide the author box of a particular user […]

Restricted images only for logged user. (hidden url)

Im looking for way to create page where only logged in user can see images, but images cant be index by browser, cant be accessed by not logged in user. Simply, if logged in user copy image link, and not logged in user try see it, he should see 404 or some other redirect, logged […]