Notice: Undefined property: wpdb::$current_post What can be wrong?

I’m working on a WordPress site and I use the following code to show posts in two columns on archive and category pages: <div id=”post-<?php the_ID(); ?>” <?php post_class( 0 === ++$GLOBALS[‘wpdb’]->current_post % 2 ? ‘grid col-340 fit’ : ‘grid col-340’ ); ?>> With debug set to “true” I got the following notice: Notice: Undefined … Read more

Pinterest Integration Using functions.php

I use a theme to build an portfolio. I´d like to add an pinterest “pin-it button” into the fuctions.php: Facebook, Google+ an Twitter were done, just the pinterest won´t work. Can´t found the the wrong code. This ist my code: function share_this($content){ if ( is_singular( ‘portfolio’ ) ) { $content .= ‘<div class=”share-this”>’ . /* … Read more

Date/time limitation of posts where function must be executed

I have this piece of function in my functions.php file: function user_content_replace($content) { $sentences_per_paragraph = 3; // settings $pattern = ‘~(?<=[.?!…])\s+~’; // some punctuation and trailing space(s) $sentences_array = preg_split($pattern, $content, -1, PREG_SPLIT_NO_EMPTY); // get sentences into array $sentences_count = count($sentences_array); // count sentences $output=””; // new content init // see PHP modulus for($i = … Read more

API integration with WordPress

I’m trying to integrate a 3rd party API with WordPress. I fear this is above my head. I was this code but I’m not exactly sure how to make is work in WordPress. Is it possible? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, ‘https://xxx’); curl_setopt($ch, CURLOPT_POST, 7); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( ‘auth_token’ => ‘xxxxxx’, ‘list_id’ => ‘xxxxx, ‘name’ … Read more

Including Angle Brackets In Pre Sections

I am attempting to post some java code between pre tags but the angel brackets get removed. For example: private HashMap<String, HashMap<String, Integer>> featureCounts; becomes private HashMap> featureCounts; Is there a way I can render the actual code? Also I am not a php developer or a wordpress expert by any means, so modifying the … Read more

How to create a custom button for the visual editor that adds 4 non-breaking spaces? (plugin or simple code)

To WordPress’ visual editor (TinyMCE), I would like to add a button that adds four non-breaking spaces when clicked, like this: &nbsp;&nbsp;&nbsp;&nbsp; I found some plugins that add buttons to the HTML editor, but not to the visual editor (this one for e.g). or in general, it would be nice to know if there’s a … Read more