Apart from the fact, that the conditional is based on a WordPress option, this is pure PHP, but anyhoo:
<?php
$show_views = get_option( 'to_post_views' );
if ( 'Yes' === $show_views ) {
echo '<div class="postviews">' .
getPostViews( get_the_ID() ) .
'</div>';
}
?>
Related Posts:
- Enqueue Javascript Correctly for 3.5
- Best way of adding CSS which can be manipulated by the user via theme option panels?
- Using PHP to toggle stylesheet and header image, set in cookie
- Shortcode content output but not in correct place
- Adding Default Settings to Theme My Login plugin
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- How to style options page in dashboard?
- Css loads very slow [closed]
- responsive.css in the WordPress should be prioritized
- Redirect to another page using contact form 7? [closed]
- Security for data obtained from the database
- height should be set to auto to avoid pixelation in the post thumbnail function
- How to make container class in PHP
- Creating a mobile site by adding a new class to the body tag from functions.php
- How to Change CSS Colors from Custom Plugin Settings Page
- CSS change in woo commerce Place Order Text [closed]
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Post Views Code Hacks
- how to changes mobile menu toggle breakpoint in WordPress
- PHP function for horizontal Woocommerce thumbnails and badges
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- I got big white screen when i attach main style sheet of Html in functions.php
- Site title not showing. Please help me
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Add class for the_post_thumbnail_caption()
- Displaying POST content with HTML tags and all
- Highlight Single Page Ancestor
- Styling admin page rows in order of importance (checkboxes)
- How to have Function of a plugin using global vars into a shortcode?
- Cant get theme to change footer color through theme customizer
- How to add margin underneath woocommerce total price amount -> productpages
- How do I get Roboto Google Font to display normal font-style? [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Options.php loop won’t show!
- Echo get_option displays as text
- Sorting Problem
- Dynamic Email Handler with ‘header (“Location: …’
- How do I make a shortcode to display Dokan seller badge list?
- How can we upload custom page files?
- Calling a PHP function from a menu item
- Removing website URL in comments causes misalignment of submit button and tickbox
- Displaying theme options in css
- Show post in slider
- PHP code inside shortcodes
- Limiting woocommerce line_total decimal length
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Problem adding class to body_class
- Run a filter when a walker runs
- How can I use wp_insert_comment to write a comment when a post is edited?
- Using Multiple Submit buttons to trigger customised php functions
- Removing unneccessary p-tags (Not every p)
- Add a custom stylesheet for BlackBerry
- How to remove the excerpt in the Dzonia Lite theme
- comments_number display outside specified span
- Choose To Display Post Views With An Options Panel
- Prevent Data Resubmission On Page refresh
- Set WordPress Default Template
- How can I hide Home in my menu in a specific page?
- Shortcode content filter?
- Missing sidebar parameter “fix” – before_content
- SQL QUERY – Select a value directly from the database
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- How do I display a user’s previous orders as a select box option on a product?
- How Display Posts on category
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- allow subscribers to see private posts without plug in
- Replace word in “the_content” only for index.php
- How do you add customer capability after Woocommerce purchase?
- How to get specific image in media library with php
- Function set default image when image not present
- Custom location for attached images
- WooCommerce – Reset quantity input field when variation changes
- Query all posts of a custom taxonomy term
- get current product name in functions.php
- Get first URL from post content
- Setting custom canonical urls
- Handling Body class based on Template
- Trigger popup in a php if/else statement
- Setting a cookie upon specific URL visit
- Get_avatar filter?
- How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts
- Can’t get page content in WordPress
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- Way to querry data (tags) from a wordpress database?
- get post based on category chosen in drop down – The ajax method
- Slider loading issue
- How to add values to media “whitelist_options” in wp-admin/options.php template?
- Image as Sales Badge
- how to make separate field in wordpress user_data_
- Function not working at one place
- jQuery not defined
- Displaying the Month and Year that a page was Created?
- Changing custom logo link
- Add a class to the anchor tag on HTML5 gallery
- Conditional Header in wordpress
- Remove meta description on certain pages
- Menu — How to add “current-menu-grand-ancestor” css class
- Plugin CSS not enqueing
- Use menu link or onClick to set a variable