wp_get_attachment_url not working

Add the PDF attachment ID as a custom field value, for example attached_pdf_id. Get the URL using wp_get_attachment_url(): <?php if ( is_user_logged_in() ) { $pdf_link = wp_get_attachment_url( get_post_meta( get_the_ID(), ‘attached_pdf_id’, true ) ); if ( $pdf_link ) { ?><a href = “https://wordpress.stackexchange.com/questions/89809/<?php echo $pdf_link ?>” >Download</a><?php } else { ?>Sorry, no link available. Please contact … Read more

Text in permalink

There is no template for “/widget”. Templates are about content types and not URL fragments. IMO your page hack is totally legit. Another way to handle this is to have a widgets category which is the parent of all other categories and change your permalink structure to /%category%/%postname%/

WordPress a template for subcategories fo a given category, but not for root category

I managed to solve this in a procedural way: 1 added in theme function this snippet: add_action(‘template_redirect’, ‘load_category_tree_template’); function load_category_tree_template() { if (is_category() && !is_feed()) { // replace ‘your-base-category-slug’ with the slug of root category $base_tree_cat_id = get_cat_id(‘your-base-category-slug’); // get current category id $catid = get_query_var(‘cat’); if (is_category($base_tree_cat_id) || cat_is_ancestor_of($base_tree_cat_id, $catid)) { load_template(STYLESHEETPATH . ‘/category-your-base-category-slug.php’); … Read more

How to make plugin work in each template in wordpress

You would have to put your code in your question into a function. Maybe something like function wpse_91897_get_image() { }. Then try the code below. I haven’t tested this but it should work. function wpse_91897_display($content) { global $single; $output = wpse_91897_get_image(); if (is_single()) { return $content . $output; } else { return $content; } } … Read more