Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1335435

    Hi Guys,

    Display Blog
    A site I am working on uses a custom JS script to make the whole element clickable rather than just the image and title.
    See below:

    	// News Page JS
    	window.addEventListener('DOMContentLoaded', function() {
    	(function ($) {
    	    if ($("body.news-page .template-blog article").length == 0) {
    	        return;
    	    }
    
        // Whole Article Clickable
        $("body.news-page .template-blog article").each(function (elem) {
            var thisElem = $(this);
            var newsPostLink = thisElem.find(".read-more-link a").attr("href");
            thisElem.append('<a href="' + newsPostLink + '"></a>');
        });
    }(jQuery)); 
     });

    However when we use the Enfold custom post type called Link. It still displays a link to the blog instead of the URL from the post.

    Where does Enfold save the Link when post type link is set?
    I need to change the script above so it picks the correct destination rather than opening the post.

    #1335529

    Hey Thomas,

    Thank you for the inquiry.

    Where do you select the “Link” custom post type? The theme doesn’t create a post type with that name by default. Are you using a plugin to create it? Please provide a screenshot or a link to the page so that we can inspect it.

    Best regards,
    Ismael

    #1335561

    Hi Ismael,
    This shows just how little time I spend with a WordPress default theme enabled.

    The Post Formats are a WordPress function and not specifically Enfold so outside of your scope. Sorry for reporting this as an issue.

    Please close this issue as solved.

    I have fixed this after reading through the JS with a bit more care.
    I changed the custom JS script to look for .blog-meta a instead of .read-more-link a. This grabs the custom post link instead of the read more link solving the issue.
    ORIGINAL

    	// News Page JS
    	window.addEventListener('DOMContentLoaded', function() {
    	(function ($) {
    	    if ($("body.news-page .template-blog article").length == 0) {
    	        return;
    	    }
    
        // Whole Article Clickable
        $("body.news-page .template-blog article").each(function (elem) {
            var thisElem = $(this);
            var newsPostLink = thisElem.find(".read-more-link a").attr("href");
            thisElem.append('<a href="' + newsPostLink + '"></a>');
        });
    }(jQuery)); 
     });

    CHANGED TO

    	// News Page JS
    	window.addEventListener('DOMContentLoaded', function() {
    	(function ($) {
    	    if ($("body.news-page .template-blog article").length == 0) {
    	        return;
    	    }
    
        // Whole Article Clickable
        $("body.news-page .template-blog article").each(function (elem) {
            var thisElem = $(this);
            var newsPostLink = thisElem.find(".blog-meta a").attr("href");
            thisElem.append('<a href="' + newsPostLink + '"></a>');
        });
    }(jQuery)); 
     });
    #1335671

    Hi,
    Glad to hear that you have this sorted out, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Where does Enfold Retrieve Post Links from?’ is closed to new replies.