GK Portfolio Not Working with Post Slug data source

Beautiful and responsive WordPress theme with amazing parallax effect.
GK User
Tue Feb 18, 2014 10:21 pm
I am trying to have GK Portfolio display specific items using the post slug data source, and unfortunately, it seems that this isn't working. It will display the first post correctly, but every post following it will show the latest post.

For example, if I use the same post slug 12 times, it will show the correct post once, then 11 posts will be the latest post over and over. Is there a fix for this?

gkport-post-slug-issue-1.jpg
User avatar
Fresh Boarder

GK User
Wed Feb 19, 2014 8:42 am
Hi,

Thanks for your feedback, your're right, there's a problem with post slugs, probably noone use the same post slug earlier :)

you have to edit gavern/widgets.portfolio.php file and change this fragment (around line 118):
Code: Select all
$post_slugs = explode(',', $config['data_source']);
         foreach($post_slugs as $slug) {
            array_push($results, get_posts(array('name' => $slug)));
         }

to:
Code: Select all
$post_slugs = explode(',', $config['data_source']);
         foreach($post_slugs as $slug) {
            $res = get_posts(array('name' => $slug));
            array_push($results, $res[0]);
         }

and this (around line 152):
Code: Select all
if($this->wdgt_config['data_source_type'] == 'post' || $this->wdgt_config['data_source_type'] == 'custom') {

replace with
Code: Select all
if($this->wdgt_config['data_source_type'] == 'custom') {               


This fix will be also added in next theme update. Thanks again.
User avatar
Moderator

GK User
Wed Feb 19, 2014 2:10 pm
Fix worked perfectly, thanks!
User avatar
Fresh Boarder


cron