Support » Plugin: Hikari Category Permalink » How to use Hikari Category Permalink Plugin on Custom Post Types

  • This file:

    contains this function: public function insertPostJS (see full function below)

    You have to go to the edit Post interface in WordPress and find the div id from the html that contains the taxonomy selection box.

    Add more lines as shown below that start with — echo “<script type ….
    and add your div id as shown below.


    public function insertPostJS(){

    $url = $this->plugin_dir_url . ‘/scategory_permalink.js’;
    echo “<script type=\”text/javascript\” src=\”$url\”></script>\n”;

    global $post;

    $categoryID = ”;
    if($post->ID) {
    $categoryID = get_post_meta($post->ID, ‘_category_permalink’, true);
    echo “<script type=\”text/javascript\”>jQuery(‘#categorydiv’).sCategoryPermalink({current: ‘$categoryID’});</script>\n”;

    echo “<script type=\”text/javascript\”>jQuery(‘#events_categoriesdiv’).sCategoryPermalink({current: ‘$categoryID’});</script>\n”;
    echo “<script type=\”text/javascript\”>jQuery(‘#faq_categorydiv’).sCategoryPermalink({current: ‘$categoryID’});</script>\n”;

Viewing 1 replies (of 1 total)
  • Two more changes to make this work well …

    In file: wp-content/plugins/hikari-category-permalink/hikari-category-permalink-core.php
    Comment out the following line and replace it with the one below using the “wp_get_object_terms” function. you must add your own taxonomy slugs in the the “array (‘category’,’your_slug1′, ‘your_slug2’)”

    //$cats = wp_get_post_categories($post->ID);
                            $cats = wp_get_object_terms($post->ID, array('category','events_categories','faq_category'), array('fields' => 'ids') );

    In file: wp-content/plugins/hikari-category-permalink/scategory_permalink.js
    Add the slugs again in the javascript file ….

    function onClick(event) {
          var current = $(this).prev('label').find('input').val();
          $('#in-popular-category-' + current + ',#in-category-' + current + ',#in-events_categories-' + current + ',#in-faq_category-' + current).each(function() {
            $(this).parent('label').css('fontWeight', 'bold');
            $(this).attr('checked', true);

Viewing 1 replies (of 1 total)
  • The topic ‘How to use Hikari Category Permalink Plugin on Custom Post Types’ is closed to new replies.