WordPress.org

Ready to get started?Download WordPress

Forums

Network Latest Posts
"uncategorized" generated in url, breaking the link to the post" (2 posts)

  1. martypao
    Member
    Posted 1 year ago #

    My website provides virtual tours or image slideshows for Realtors. I use Network Latest Posts to advertise the most recent virtual tours in a sidebar using the N.L.P. plugin widget.

    It has been fine until now. Instead of coding a new virtual tour template for wp3.5, I purchased a theme "Freehold" that I am now using for the virtual tour.

    Here is the link that shows:
    http://virtualtours.promediatours.com/uncategorized/1004-goldfinch-court/
    Here is what I need to show:
    http://virtualtours.promediatours.com/property/1004-goldfinch-court/

    Note: The virtual tour is a Custom Post Type of "property". The widget displays the custom post type properly. But generated link will take you to a 404 page.

    Also note: No matter what is set in permalinks, the only way that the virtual tour post will display is for the url string to be:
    1.website / 2. the taxonomy "property" / 3. the virtual tour post slug.

    Any help would be appreciated. Thanks.

    Marty Paoletta
    ProMedia Tours

    http://wordpress.org/extend/plugins/network-latest-posts/

  2. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Marty,

    I think this problem is due to the change of themes, have you tried to refresh the permalink structure? Settings > Permalinks

    It seems your new theme uses a different permalink structure, using post types instead of categories, this may be causing the wrong behavior. Permalinks are stored into the database, when pulling them through the plugin, links pointing to the previous permalink structure are retrieved.

    Your current structure is pointing to: %category%/%postname% when it should be pointing to: property/%postname% in case your blog will only serve information through the 'property' post type.

    Another possible solution is to use jQuery to replace categories by post types, in this case something like:

    jQuery(document).ready(function() {
          jQuery(".nlposts-block-thumbnail a").each(function() {
               this.setAttribute("href", this.getAttribute("href").replace(/\uncategorized/, "property"));
          });
    };

    Put the code into a file called nlp-links.js, then save it into your active WordPress theme folder (from the blog you're using Network Latest Posts), next open the functions.php file located inside the same folder and add these lines to the end, right before the php closing tag ?>:

    function nlp_load_links() {
          wp_enqueue_script('nlp-links',get_stylesheet_directory_uri().'nlp-links.js');
    }
    add_action('wp_enqueue_scripts', 'nlp_load_links');

    The script will replace all 'uncategorized' (categories) by 'property' (custom post type), you can see the code working here: http://jsfiddle.net/6nKfW/

    Let me know if you need more help.

    Kind regards,
    José Luis

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic