In WordPress, content in your site that is not controlled in the Posts, Pages, Widgets or Links in the Administration area almost always will be found in the .php
files in your theme.
So to find the test "Enjoy this article" you'll need to get familiar with editing theme files. It's likely that this text is in a file called index.php
and/or single.php
, though may be in other places also.
If your website resides in a folder called public_html
, and wordpress is installed in a directory called blog
, then your theme files will be at this path: public_html/blog/wp-content/themes/{theme_name}/
. You will need to edit the index.php
and/or single.php
files at this path, where {theme_name}
is the directory of your active theme.
Best of luck!
Even though it is a recommended practice in Wordpress to have functions that return values, it is not always possible, especially when you are calling another function that writes it's output directly to the stream.
When the component writes it's output directly to the stream you need to code to accommodate that behavior unless you want to rewrite the who component (I wouldn't do that ;-) ).
In this instance the the_views() function actually offers you both options. If you look at the $display parameter and follow the code this function can behave both ways. If $display is set to True (it's default) it will echo the results of the function. If $display is set to False it will return the output.
So you have two options, both of which should work:
Option 1, Return a value
Note that when I call the_views() I pass it a false parameter like this: the_views(false)
<?php
function video_block( $atts, $content = null ) {
return "<div class=\"video-block\"><span class=\"ViewCount\">" . the_views(false) . "</span><a class=\"dl-source\" href=\"$content\">Link</a></div>";
}
?>
*Option 2: Echo your output *
Note that when I call the the_views() there are no parameters passed to it.
<?php
function video_block( $atts, $content = null ) {
echo "<div class=\"video-block\"><span class=\"ViewCount\">";
the_views();
echo "</span><a class=\"dl-source\" href=\"$content\">Link</a></div>";
}
?>
Oh, also, don't forget to escape your quotes when you are returning a string.
Best Solution
you must return the content from your filter not echo it - so something like
would be the way to go