Adding custom directory and PHP files in wordpress

The github repo seems to be a custom code that you need drop into your theme directory, update your config file using your twitter credentials and try putting this code inside the body in any of your intended theme files that you will use(eg, index.php) <h1>Tweets of a certain user</h1> <div class=”stream”> <h2><span>Twitter</span></h2> <ul class=”timeline”></ul> … Read more

How to deal with checkboxes in edit page?

I managed to crack this nut after few days of experimenting. <!– Note how name attribute has actual number in brackets –> <input type=”checkbox” name=”feature[1]” id=”feature-one” value=”feature_one”<?php if ( $feature_one ) { echo ‘checked’; } ?> /> <input type=”checkbox” name=”feature[2]” id=”feature-one” value=”feature_one” <?php if ( $feature_one ) { echo ‘checked’; } ?> /> <?php //This … Read more

Getting id of poll from WP database

The first problem I spotted is that you aren’t setting $latest_pollid but you are nonetheless trying to use that as the poll id. You should have something like: $latest_pollid = polls_latest_id(); before that line in order to set the value. There are big problems with what you are doing though. Hooking to after_setup_theme means that … Read more

WP functions in .js

To access server-side functions you’ll need to trigger a server event from JS using AJAX, JSON API, XML/RPC, custom endpoints, or even template_redirect hooks. Just be sure to liberally sprinkle nonces when performing major functions. The simple and proven technique is the AJAX call. Setup a couple handlers when AJAX receives an action while the … Read more

What is a valid parent for get_terms()?

The only variable which can really have an effect on the result as you described, is taxonomy. If you have verified that there are terms with a parent of 1 and a parent of 5, and get_terms() only returns terms for terms with a parent of 1, it can only mean that term 1 and … Read more

add_action shortcut?

From the WordPress development reference, the add_action function requires two parameters with an optional two. The first parameter, $tag is a string that is the name of the action to which the $function_to_add is hooked. The second parameter, $function_to_add is a callable that the WordPress developer reference states is “the name of the function you … Read more

WP Query with custom Shortcode

There are few issue with your code When using WP_Query in conjuction with the_post() or using get_posts() in conjuction with setup_postdata( $post ), you need to reset the $post global with wp_reset_postdata(), not wp_reset_query(). wp_reset_query() is used in conjuction with query_posts() which you should never ever use You would want to reset posdata between your … Read more