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