Add content in between of foreach

You can keep tracks of number of cycles and run extras when counter matches. Something like this: $array = array(1,2,3,4,5); $i = 0; foreach($array as $set) { if(2 == $i) echo ‘after 2’; if(4 == $i) echo ‘after 4’; echo $set; $i++; } I must note that this is more of PHP basics and really … Read more

How to customize feed?

Feed templates are special case. You can’t simply provide your own template – you need to work with do_feed_ hooks to change handler function. But for your specific question it is much easier to override author. Try this (not tested): add_filter( ‘the_author’, ‘feed_author’ ); function feed_author($name) { if( is_feed() ) return ‘Acme, Inc.’; return $name; … Read more

Problem with theme activatation

This theme seems to be made for Buddy Press and declares that it is child of bp-default theme, which is not standalone – supplied with Buddy Press plugin. I am not quite sure why it is in repository at all, as far as I know child themes are still not supported there.

Instant install of wordpress

Update: You can use WordPress QI – http://wpquickinstall.com/download/ Not all servers can run SVN, and servers which have problem in WP 5minute install, can’t be cope up with another solution because there is no solution, sometimes server settings are to blame. That said, on a server where everything works fine for a regular installation, WordPress … Read more

Problem with custom user meta field

if ($authorgender = “male”) { Needs to be if ($authorgender == “male”) { == is a comparison operator http://www.php.net/manual/en/language.operators.comparison.php = assigns the value to the variable http://www.php.net/manual/en/language.variables.basics.php

How to store page visit counts?

You can use custom fields for this. What I would suggest is setting up a shortcode you can put on any page you want to show the counter. For an extremely basic example with no HTML formatting, you can do this: add_shortcode( ‘examplecounter’, ‘counter_shortcode’ ); function counter_shortcode( $atts, $content = null ) { global $post; … Read more

Adding comments to my custom theme

While much of comments implementation became simpler in modern WP versions, it still isn’t quite make-comments-happen button. You will need to put together this part of template, most of related functionality is handled by: wp_list_comments() comment_form() Check native WP themes for complete start to end implementation, although they tend to be a little bulky.

How to customize and keep things up-to-date?

The key to upgrade-proof customizations is to never edit plugins directly. You should use actions and filters to hook into a plugin’s code. Not everything is customizable through these hooks, though. The amount of useful hooks provided depends on the quality of the plugin code. Also see: Hooking in to plugins If you really would … Read more