wordpress count link clicks by ip address

What would you do if the user uses a proxy and randomizes his IP address? There are numerous browser plugins to simplify that to a click of a button to download multiple times. The same goes for cookies. Aside from that you are trying to collect data that allows to identify users, which is illegal … Read more

WSoD being caused by this piece of code

You have a problem with your code formatting and syntax at the very least: function ref_access(){ global $error; if (is_user_logged_in()) // <– problem here… $newdb = new wpdb( ‘user’, ‘pass’, ‘db’, ‘localhost’ ); global $newdb; $hf_username = wp_get_current_user(); $inputValue = $_POST[$quanid]; $wpdb->insert( $table, array( ‘ItemID’ => $quanid ‘Price’ => $inputValue ‘user’ => $hf_username ), ); … Read more

Get updated query results on page after insert in database

Move insert query to top of file. So it will select updated data. <?php // Save form data if(isset($_POST[‘submit’])){ global $wpdb; $votes = 1; $competition = $_POST[‘comp’]; $uid = $_POST[‘id’]; //$uid = get_current_user_id(); echo ‘id of image=”.$_POST[“id’]; echo ‘<br>’.’competition is’.$_POST[‘comp’]; if($wpdb->insert( ‘votes’, array( ‘votes’ => $votes, ‘competition’ => $competition, ‘uid’ => $uid ) ) == … Read more

WP dynamic featured image – Can’t get second featured image url

To get featured images of specific post/page use these below code – if( class_exists(‘Dynamic_Featured_Image’) ) { global $dynamic_featured_image; $featured_images = $dynamic_featured_image->get_featured_images( $postId ); //You can now loop through the image to display them as required } Please follow this link – https://github.com/ankitpokhrel/Dynamic-Featured-Image/wiki/Retrieving-data-in-a-theme

Changing layout with wp_customise

You need to check against the value of layout: if ( get_theme_mod( ‘layout’ ) === ‘stream’ ) { // Stream } elseif ( get_theme_mod( ‘layout’ ) === ‘grid’ ) { // Grid } else { // Fallback }