This one is original and works properly.
echo "<font face=arial size=2><b>Users Online: $n_u_online</b>";
?>
https://1.bp.blogspot.com/-HSDMjVHkrOA/YFt3AdZd8tI/AAAAAAABFo0/VjKId5hHbmElgfcgIK7x90TiPJjU0sJGQCLcBGAsYHQ/s16000/Ads%25C4%25B1z2.png
But I want to do this with Css. I coded it like this but I cannot print the online issue "$ n_u_online" is reflected on the site
echo '<div class="view-meta">Users Online: $n_u_online</div>';
?>
https://1.bp.blogspot.com/-fiQtwYBO2Fo/YFt3AY2JbWI/AAAAAAABFo4/KhRJb7Q6XMQK4_ddLjGZAZWF64dm4XaogCLcBGAsYHQ/s16000/Ads%25C4%25B1z.png
Help me please.
Try this :
echo "<div class='view-meta'>Users Online: $n_u_online</div>";
Or this :
echo '<div class="view-meta">Users Online: '.$n_u_online.'</div>';
Related
This is a Word Press/PHP question (very beginner, I'm not a programmer). Trying to find were is the code that display the date in posts page because it's showing the today date instead of the post published one. In the post-info.php I found this code displaying date:
else {
if ($info_parts['date']) {
$post_date = apply_filters('themerex_filter_post_date', $post_data['post_date'], $post_data['post_id'], $post_data['post_type']);
$post_date_diff = themerex_get_date_or_difference($post_date);
?>
<span class="post_info_item post_info_posted"><?php echo (in_array($post_data['post_type'], array('post', 'page', 'product')) ? esc_html__('Posted', 'themerex') : ($post_date <= date('Y-m-d') ? esc_html__('Started', 'themerex') : esc_html__('Will start', 'themerex'))); ?> <a href="<?php echo esc_url($post_data['post_link']); ?>" class="post_info_date<?php echo esc_attr($info_parts['snippets'] ? ' date updated' : ''); ?>"<?php echo ($info_parts['snippets'] ? ' itemprop="datePublished" content="'.esc_attr($post_date).'"' : ''); ?>><?php echo esc_html($post_date_diff); ?></a></span>
<?php
}
Where to correct this code to show the published post date?
I'm using the bookshelf wordpress theme of themerex, verison 1.6.9
Thanks in advance!
Solved! Modified this line
<?php echo esc_html($post_date_diff); ?>
like this:
<php echo esc_html($post_date); ?>
As the title states, I am having trouble locating where to change the section titles that are currently h2 to be h1.
Site in reference: http://veloxity.us
Any insight or advice would be much appreciated!
In the "sections.php" page in the "functions/templates" folder on line ~112 and ~219 there is:
<?php echo ($section_post->post_title) ? '<h2>' . apply_filters('the_title', $section_post->post_title) . '</h2><div class="clear"></div>' : ''; ?>
and
<?php echo ($section_post->post_title) ? '<h2>' . apply_filters('the_title', $section_post->post_title) . '</h2><div class="clear"></div>' : ''; ?>
Changing the <h2> to <h1> should achieve what you are wanting.
I have created chekboxes with ACF, now I can display the values of the checkboxes on my front end but I would like to show the associated labels to.
Here is my code :
echo "<ul>";
$profession = get_field('profession');
foreach($profession as $key => $check){
echo "<li>".$check."</li>";
};
echo "</ul>";
Thanks a lot !
try this: http://www.advancedcustomfields.com/resources/functions/get_field_object/
You can return all the field's metadata with get_field_object().
if( get_field('field_name') ):
echo '<div class="class_for_display">';
echo 'Label:'; echo'<p>' .the_field('field_name').'</p>';
echo '</div>';
endif;
i use this code in function.php of child theme
I'm trying to display code snippets entered into my custom field. An example code snippet entered into custom field - snippet-1
<?php
if (($wp_query->current_post + 1) < ($wp_query->post_count)) {
echo '<div class="post-item-divider">Post Divider</div>';
}
?>
If I try to display this code wrapped in <pre></pre> tags in my page template like
<?php if ( get_post_meta($post->ID, 'snippet-1', true) ) : ?>
<pre><?php echo get_post_meta($post->ID, 'snippet-1', true) ?></pre>
<?php endif; ?>
but it returns nothing to the template. I understand WordPress is filtering the snippet out as it sees as PHP code to execute. Is there a way just to print this out on the page as a code snippet?
Many thanks in advance
rob
Use htmlspecialchars() to escape your code.
Update
echo htmlspecialchars(get_post_meta($post->ID, 'snippet-1', true));
Here is what i've done so far but i just keep getting an error
<?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
<iframe src="http://www.madisonb2b.co.uk/stockenquiry.aspx?id=B8FxKDnJ%2bIdaPT1Nw5wo4r87qHuHcCQIPZzeUE%2fI36LIFOM%2bayBi2RSXHzIJS5Hj97JNSyYL80Q%3d&code=<?php {$product_model} ?>"</iframe>
Any ideas?
Thanks,
Scott
<iframe src="http://www.madisonb2b.co.uk/stockenquiry.aspx?id=B8FxKDnJ%2bIdaPT1Nw5wo4r87qHuHcCQIPZzeUE%2fI36LIFOM%2bayBi2RSXHzIJS5Hj97JNSyYL80Q%3d&code=<?php echo $product_model ?>"</iframe>
(will work if $product_model is defined by the time you echo it, of course.
Did you want to say
echo $product_model
instead of
{$product_model}
?