Articles of theme development

Compact pingback list with favicons

On a blog with pingbacks and trackbacks (pings) enabled I want to show just a link with link text and a favicon of the external site in a compact list: no date, no text. How can I do that?

Changing the template hierarchy

Is there an easy way to change the WP default template hierarchy? For instance; Say I want to change my theme directory structure so that it completely changes from the Template Hierarchy suggested here based upon conditionals: http://codex.wordpress.org/Template_Hierarchy If I wanted to make sure that for all page types (is_single() is_home() etc) it always opens […]

WP_Query returns no results

I’m using wp_query to create a custom query that retrieves search results but it is returning 0 results. Here is the code: $query = ‘s=the&posts_per_page=5&paged=1′; $custom_query = new WP_Query(); $custom_query->query($query); if( $custom_query->have_posts() ) { while ( $custom_query->have_posts() ) : $custom_query->the_post(); $this->get_article(); endwhile; } else $this->posts_404(); When I search for the word ‘the’ through the search […]

Including Javascript options

For a WordPress Theme I know javascript files (ending in .js) must be included using wp_enqueue_script in functions.php but how do I include additional javascript code? For example, say I need to add this: jQuery(function($){ jQuery.supersized({ slides: [ ‘http://google.com’, ‘http://google.co.uk’ ] }); }); Where would I put this? Do I put it within <script> tags […]

How to make Home Menu( Front Page) use index.php instead of page.php

I needed a “Home” menu item in my wordpress website, so I created a new page and named it “Home”, added it to my main menu item and then from Reading Settings I selected the “Home” as Front Page. Now the problem is, the Home is using page.php instead of index.php. I really need to […]

Custom Taxonomy Tag Search

I have an existing WordPress search function, what I’d like to be able to do is extend the search to the tags from my custom taxonomy…how do I do that? <form method=”get” id=”searchform” action=”<?php echo home_url(); ?>”> <input type=”text” value=”Product Search…” name=”s” id=”s” /> <input type=”image” src=”<?php bloginfo(‘template_directory’) ?>/images/icosearch.png” id=”searchsubmit” value=”” /> </form> I tried […]

file_get_contents Not allowed in Themes?

I’m using file_get_contents in a theme development (in a widget of the theme). However the theme check plugin gives me following warning: WARNING: file_get_contents was found in the file file.php possible file operations. Line 49: $data = file_get_contents ( ‘http://example.com’); Line 62: $count= file_get_contents ( $cfile ); My question is that if it is not […]

How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)

I’ve created my own theme based on a very lean template. My theme is not parsing the markup to the correct html. It’s just showing the text without any markup around it. Here are the relevant observations for my situation: When editing the post it shows in “Text” mode, and a nice image with caption […]

How do I access the media settings

I have been trying to find a way to access the the maximum width of a large image as set on the media settings page? In my theme I am grabbing images from a server and have the ability to specify the size when I grab them. I want to grab the image with the […]

Why is this Ajax not working?

I’m not sure if I am abusing WordPress and Ajax by doing it this way but WP and Ajax Codex a well as Plugin Development with Ajax do not seem to be very helpful. I have created the following Ajax situation: (function($){ $(document).ready(function(){ $(‘a’).click(function(e){ var el = $(this).prev(‘input[type=”checkbox”]’); if(el.is(‘:checked’)){ el.prop(‘checked’,false); } $.ajax({ url : “<?php […]