How do I add this variable to this code? How do I add this variable to this code? wordpress wordpress

How do I add this variable to this code?


You don't have to use $website_url after all. This is the part of the expand_ratings_template function that you want to edit.

 if (strpos($template, '%POST_URL%') !== false) {        $post_link = get_permalink($post_id);        $value = str_replace("%POST_URL%", $post_link, $value);    }

Shall become:

   if (strpos($template, '%POST_URL%') !== false) {            $custom = get_post_custom($post_id);            $post_link = $custom["website_url"][0];                $value = str_replace("%POST_URL%", $post_link, $value);            } 

Hopefully that works. If not, insert a

print_r($custom); 

after the line

$custom = get_post_custom($post_id);

and post the content here!


You can insert it almost anywhere you want - what are you trying to achieve?

Do you want to send $website_url as a paramater to that 2 functions?