christhomas32
Forum Replies Created
-
Forum: Plugins
In reply to: [EWWW Image Optimizer] jpegtran not detectedThe
ldconfigcommand did it, thank you!Pesky permissions always get me, thanks for the tip.
Forum: Fixing WordPress
In reply to: Upload Value to Custom Field in BulkThe value is different for each page, same key though.
Forum: Fixing WordPress
In reply to: Output a variable in a custom post template from a pluginHow would I go about doing that?
Forum: Fixing WordPress
In reply to: Retrieving a variable from a plugin and inputing to templateSure,
The template:
http://pastebin.com/82eQw7pTand the function as it is currently in my comment plugin:
function calc_avg( $post_id ) { // Calculate rating averages $args = array( 'ID' => $post_id, 'status' => 'approve', ); $comments = get_comments( $args ); foreach( $comments as $comment ) { $tot_stars += get_comment_meta( $comment->comment_ID, 'rating', true ); } global $testvar; $testvar = 1; $no_of_comments = get_comments_number( $post_id ); $GLOBALS['$avg_rating'] = ($tot_stars / $no_of_comments); global $avg_return; if ($no_of_comments > 0) { $avg_return = $avg_return; return $avg_return; } else { return $avg_return; } }Forum: Fixing WordPress
In reply to: Retrieving a variable from a plugin and inputing to templateSo I have tried passing
echo $post_id;and `while( have_posts() ) {
the_post();
echo calc_avg( get_the_id() );
}`Both did not pass any value, however there were no fatal errors. My loop is slightly adjusted, maybe this could affect it?
<?php query_posts(array('post_type'=>'products')); ?> <?php $mypost = array( 'post_type' => 'products' ); $loop = new WP_Query( $mypost ); ?> <?php wp_reset_query(); ?>EDIT:
echo the_ID();returns an integerForum: Fixing WordPress
In reply to: Retrieving a variable from a plugin and inputing to templateThanks for the replay Andrew, I am working a plugin I have created. In a comment addition plugin, I have added the ability to add a rating (1-5). I am now calculating and trying to display the average of the ratings
$avg_rating = ($tot_stars / $no_of_comments);. I have logic that allows this to work and be displayed within the comments themselves, however I want them to be displayed on my custom post template. I have tried adding my calculations to a function as you have recommended as such:function calc_avg( $post_id ) { // Calculate rating averages $args = array( 'ID' => $post_id, 'status' => 'approve', ); $comments = get_comments( $args ); foreach( $comments as $comment ) { $tot_stars += get_comment_meta( $comment->comment_ID, 'rating', true ); } $no_of_comments = get_comments_number( $post_id ); $GLOBALS['$avg_rating'] = ($tot_stars / $no_of_comments); if ($no_of_comments > 0) { $avg_return = $avg_return; return $avg_return; } else { return $avg_return; } }however
echo $avg_returndoes nothing. Nor doesecho calc_avg($post_id)and usingGLOBALS or globalhas not helped either. Any other ideas?Forum: Fixing WordPress
In reply to: Archive links have incorrect URLsOk, i’ll see what I want to do to adjust for this, thanks esmi
Forum: Fixing WordPress
In reply to: Archive links have incorrect URLsI may still be misunderstanding you, but
/%postname%/is what I have in my custom structure.Forum: Fixing WordPress
In reply to: Archive links have incorrect URLshttp://www.onlinearizonahomes.info/sample-post/Forum: Fixing WordPress
In reply to: adjust size of content area on static homepagedepends on if other pages are using the same classes and ids as the homepage.
Forum: Fixing WordPress
In reply to: adjust size of content area on static homepageSure, I can see by using inspect element (right click in chrome) or you could use firebug on firefox, you have various padding and margins that are separating your elements. You can look at these elements and adjust them in your stylesheet.
Forum: Fixing WordPress
In reply to: add more post on pageTry going to: Options -> Reading in the dashboard and see if you can increase the number from there.
Forum: Fixing WordPress
In reply to: Pages do not display on the web with 3.5.2Try disabling plugins one by one and seeing if one of those are the issue
Forum: Fixing WordPress
In reply to: Adding Tables to the WordPress DatabaseAlmost there, how do you “load your content” into the CPT? I have a large excel file, would I just have to import rows one at a time?
Forum: Fixing WordPress
In reply to: Adding Tables to the WordPress DatabaseI am taking a minute to grasp this.. I have hundreds of entries, it would appear that I would have to manually create a post for each of these entries than?