PHP Puzzle: Unique Styles with PHP loop

To are still call database inside the by get_post_meta() where you already have the values in $custom_fields variable. Try something like this: <?php $custom_fields = get_post_custom($post->ID); for ($i = 1; $i <= 4; $i++) { if(isset($custom_fields[“rw_location_$i”][0])){ if($i==1){ echo ‘<h1>’;} else {echo ‘<h2>’;} echo $custom_fields[“rw_location_$i”][0] if($i==1) {echo ‘</h1>’; }else {echo ‘</h2>’}; } } ?> If I … Read more

Post rating using Custom Field

First off, you should consider using using the building WordPress functionality rather than linking straight to a PHP file. Anyone could game that very easily and artificially vote up posts. To use the wordpress ajax functionality, send your ajax request to yoursite.com/wp-admin/admin-ajax.php, and use standard plugin hooks system. Tollmanz’s response is right on: your update … Read more

Including inline Custom Fields info with add_filter in functions.php

You are trying to echo within a variable. You also have encapsulated PHP tags in the string as well. You need to concatenate just the functions themselves like this: function default_content($content) { global $post; if ($post->post_type == ‘my-custom-post-type’) { $content .= ‘<p style=”text-align: center;”><strong>Custom Field Text here: ‘. get_post_meta( $post->ID, “custom-field-1”, true ).'</strong></p> <p style=”text-align: … Read more

How to use custom fields to replace top-level parent title with an image using wp_list_pages?

I went to the #wordpress irc channel and was given the answer by Marko Heijnen. He grabbed the Walker Code from /wp-includes/post-template.php and added a few lines to it. /** * Extend the default page walker class to append class names for pages that * are parents. * @uses Walker_Page * * http://wordpress.stackexchange.com/questions/11821/class-parent-for-wp-list-pages * */ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)