0

So, I know title is super confusing but I didn't know how to word it.

In the following code, the word "View:" is placed and displayed properly on the page.

<div class="myuserpropageview">View:<?php echo get_post_meta( $post->ID, 'pageview', true );?> </div>

In the following code, how can achieve the same thing? (where do I place "View:"?)

$output .= '<div class="dhvc-woo-view">';
$output .= get_post_meta($post->ID, 'pageview', true);
$output .= '</div>';

Thank you

1 Answer 1

0

any word (html) you put between the single quotes will be echoed when you echo $output. so you can do this:

$output .= '<div class="dhvc-woo-view">View: ';
$output .= get_post_meta($post->ID, 'pageview', true);
$output .= '</div>';

or

$output .= '<div class="dhvc-woo-view">';
$output .= 'View: ';
$output .= get_post_meta($post->ID, 'pageview', true);
$output .= '</div>';

it's the same.

2
  • I didnt know you can check "Accept" answer. Had to search on google how to accept an answer! Anyway Thanks Ituk! haha
    – Steve Kim
    Mar 6, 2015 at 23:01
  • haha yea, i'm also new here. it's fine!
    – Ituk
    Mar 6, 2015 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.