How to display the content only to the allowed IP address [closed]

I have tried your code and its working fine for me. <?php $allow = array(“xxx.xx.xxx.xxx”,”xxx.xx.xxx.xxx”); //allowed IPs if(!in_array($_SERVER[‘REMOTE_ADDR’], $allow) && !in_array($_SERVER[“HTTP_X_FORWARDED_FOR”], $allow) && !in_array($_SERVER[“HTTP_CLIENT_IP”], $allow)) { ?> <div class=”enclose comn-pg”> <h1 align=”center” style=”padding:10% 0;”>Access denied. This page is accessible only to customers.</h1> </div> <?php } else { ?> <div class=”enclose comn-pg”> <div id=”primary”> <div id=”content” … Read more

cURL error 6 on news area, and also won’t auto update

I had the same problem and eventually found a solution today (actually, a friend of mine did it). What I did was to edit the /etc/nginx/nginx.conf file and add resolver ip address. The configuration file in the section server contains now resolver 127.0.0.1; below you can find a part of it server { listen 443 … Read more

How can I display Custom Post type Custom Columns and its Content in a Dashboard Widget?

To answer your specific question: no, there are no hooks that would allow you to “reuse”. However, there is nothing keeping you from calling your browseCustomColumns() function in your function that renders the dashboard widget. However, in order to do that, you’d have to make a minor change your compile_dashboard_widget() function: public function compile_dashboard_widget () … Read more

Action Hook Inside WordPress Plugin Shortcode

It’s not entirely clear what your ultimate goal is, but a simple way to catch a form submission is to hook init and check if something is set: function wpd_check_post_vars(){ if( isset( $_POST[‘first_name’] ) ){ // do something } } add_action( ‘init’, ‘wpd_check_post_vars’ ); There’s no connection here between the action and your Shortcode, it’s … Read more

How to add post thumbnail dynamically using Jquery?

js (edit 4) $(function() { $(‘body’).on(‘click’, ‘.post-link’, function() { // Jquery var ajax = {}; ajax.id= $(this).attr(‘rel’); var ajaxurl=”/wp-admin/admin-ajax.php”; jQuery.post( ajaxurl, { ‘action’: ‘get_img_post_and_title’, ‘data’: ajax }, function(response){ // add html if(response.success){ $(‘#post-cont’).append(“<li>ID: “+response.data.post_id+” “+response.data.post_title+” <img src=””+response.data.post_thumb+””/> –<a href=”#” class=”close”>X</a></li>”); } } ); }); }); php (edit 4) // php add_action(“wp_ajax_get_img_post_and_title”, “get_img_post_and_title”); add_action(“wp_ajax_nopriv_get_img_post_and_title”, “get_img_post_and_title”); function … Read more

Split site title and apply different classes

Figured it out! function split_title($title) { $title = get_bloginfo(‘name’); $word = substr($title, 0 , 5); $press = substr($title, 5); $html = “{$word}<span class=”bold”>{$press}</span>”; return $html; } And then <?php echo split_title($title); ?>