Skip to main content
added 248 characters in body
Source Link
s_ha_dum
  • 65.5k
  • 13
  • 84
  • 174

This works for a page on my site with ID 675:

function tst($content) {
  if (is_page(675)) print('howdy');
}
add_action('wp_footer','tst');

I would just interrupt the function right at the top.

function keyboard_shortcut_navigation(){
    global $paged, $wp_query;
    if (is_page(2020)) return; // for a post with ID 2020
    if (is_page('2020')) return; // for a post with slug or title "2020"
    // you should only need one of those
    // ... the rest

If you are talking a posts instead of pages then maybe what you want is this:

// old
<?php if( is_single() ) : ?>
// new
<?php if( is_single() && !is_single(2020)) : ?>
// use quotes if 2020 is the title or the slug

You are hacking somebody else's plugin so you are likely to have problems when you update. I'd contact the author and ask for a hook in the next release that will allow you to do this without hacking anything.

This works for a page on my site with ID 675:

function tst($content) {
  if (is_page(675)) print('howdy');
}
add_action('wp_footer','tst');

I would just interrupt the function right at the top.

function keyboard_shortcut_navigation(){
    global $paged, $wp_query;
    if (is_page(2020)) return; // for a post with ID 2020
    if (is_page('2020')) return; // for a post with slug or title "2020"
    // you should only need one of those
    // ... the rest

You are hacking somebody else's plugin so you are likely to have problems when you update. I'd contact the author and ask for a hook in the next release that will allow you to do this without hacking anything.

This works for a page on my site with ID 675:

function tst($content) {
  if (is_page(675)) print('howdy');
}
add_action('wp_footer','tst');

I would just interrupt the function right at the top.

function keyboard_shortcut_navigation(){
    global $paged, $wp_query;
    if (is_page(2020)) return; // for a post with ID 2020
    if (is_page('2020')) return; // for a post with slug or title "2020"
    // you should only need one of those
    // ... the rest

If you are talking a posts instead of pages then maybe what you want is this:

// old
<?php if( is_single() ) : ?>
// new
<?php if( is_single() && !is_single(2020)) : ?>
// use quotes if 2020 is the title or the slug

You are hacking somebody else's plugin so you are likely to have problems when you update. I'd contact the author and ask for a hook in the next release that will allow you to do this without hacking anything.

Source Link
s_ha_dum
  • 65.5k
  • 13
  • 84
  • 174

This works for a page on my site with ID 675:

function tst($content) {
  if (is_page(675)) print('howdy');
}
add_action('wp_footer','tst');

I would just interrupt the function right at the top.

function keyboard_shortcut_navigation(){
    global $paged, $wp_query;
    if (is_page(2020)) return; // for a post with ID 2020
    if (is_page('2020')) return; // for a post with slug or title "2020"
    // you should only need one of those
    // ... the rest

You are hacking somebody else's plugin so you are likely to have problems when you update. I'd contact the author and ask for a hook in the next release that will allow you to do this without hacking anything.