0

I am using a plugin Bottom of every post

which have a a function if( !is_page( ) && file_exists( $fileName )){

which is printing custom Text on bottom of every pages, i want to show them on pages not on the posts, can anyone suggest me a function or a way to complete this job ?

Any suggestion would be appreciable.

2

Remove the ! before is_page().

The function is_page() is built into WordPress and only tests if the post being viewed is a page or not. The ! stands for "not", so if you take it out, the code will only return true on that part if it is a page.

  • I showed that i am a noob ha ha, thank you very much. – Rahul V Sharma Oct 27 '14 at 18:38
  • A good place to look up WordPress related functions is in the codex – Jesse Pearson Oct 28 '14 at 19:51
0

Rather than hack somebody else's plugin, which will require additional work every time the plugin is updated, why not use a simple filter on the_content?

function bottom_of_post_wpse_166623($content) {
  if (is_page()) {
    $extra_content = 'abcdefg';
    return $content.$extra_content;
  }
}
add_filter('the_content','bottom_of_post_wpse_166623');

You can add that code to your theme, or to a plugin of your own (which basically what the plugin you reference does).

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.