WordPress blog post url on category page

You don’t have a $post object to use $post->ID, so use get_the_ID() instead. In your loop: <?php $ptype_link_url = get_post_meta(get_the_ID(), ‘lolfmkbox_link_url’, true); ?> <h1 class=”entry-title”><a href=”https://wordpress.stackexchange.com/questions/209732/<?php echo $ptype_link_url; ?>”><?php the_title(); ?></a></h1> Reference: https://codex.wordpress.org/Function_Reference/get_the_ID

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

Troubles with saving metabox

There are different ways of saving the metaboxes. for e.g. you can create 2 files 1) test-spec.php 2) test-meta.php In test-spec.php file <?php //DEFINE VARIABLE TO STORE THE METABOX $content_test_meta = new WPAlchemy_MetaBox(array ( ‘id’ => ‘_content_test_meta’, //UNIQUE ID FOR THIS META BOX ‘types’ => array(‘post’), //LIMIT TO ONLY SHOW ON Default POST TYPE ‘template’ … 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

How to customize a permalink (URL) structure?

The GUID field is not a URL and should never be used for that purpose. It’s a unique identifier that happens to look like a URL, but it should never be trusted as such. WordPress has a number of functions for retreiving attachment URLs and files: get_children get_attached_media the_attachment_link get_attachment_link wp_get_attachment_link wp_get_attachment_image wp_get_attachment_image_src wp_get_attachment_url wp_get_attachment_thumb_file … 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