Per page add to head
[resolved] Not working on custom pages? (4 posts)

  1. webg
    Posted 1 year ago #

    I have custom pages, how to make it work on them?


  2. Erikvona
    Plugin Author

    Posted 1 year ago #

    The same question was asked in this support thread.

    Simply put, this plugin does not work with custom post types, because depending on the post type, it may not be possible and cause some incompatibilities. However, for most custom post type, the following will work:

    In the perpagehead.php file, on line 18, replace the following:
    $screens = array( 'post', 'page' );
    $screens = array( 'post', 'page', 'custom-post-slug' );
    Where custom-post-slug is the slug for the custom post type.
    Note that after modifying the plugin, you should not update it. Any update will reset the modifications.

    You can also manually add the content you want to add to the head section, by going to screen options and checking Custom Fields, and then using the custom field box to add a field with the name per-page-ath-content. Anything put in that field will be added in the head section, and this doesn't require modification of the plugin. However, some errors may occur in the preserving of whitespace, and the escaping of quotes.

    I will see about adding support for custom post types via a settings page in the future (for now I am not feeling like it), but for now, this is the way to do it.

  3. webg
    Posted 1 year ago #

    Worked perfectly. Thanks!

  4. Erikvona
    Plugin Author

    Posted 5 months ago #

    Custom post support is added in version 1.2, which will probably launch today. You can now set the custom post types you want to add stuff to under Settings -> Per Page Add To Head.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Per page add to head
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.