New Landing How can we help? Themeforest Theme Support Dante Tiled Gallery limited to 500px

Viewing 11 posts - 1 through 11 (of 11 total)
  • Posted in: Dante
  • #81648
    rely27
    Member
    Post count: 55

    Hi,

    I know this is basically a Jetpack issue but just want to be sure if you heard about and if it’s not a compatibility with your theme. I’m using the tiled gallery from the jetpack plugin and since the latest update of wordpress and/or theme (i’m not really sure in the end) the gallery is limited to 500px in width.

    You can see an example here : http://www.la-thailande-et-l-asie.com/test-galerie/

    Any clue what could be wrong ? (already contacted Jetpack support, asked me as usual to deactivate all plugins, did it with no luck…)

    #81673
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    It seems to have an inline style of 500px width, I’m afraid I do not know how to fix that, please ask the plugin developers

    – Kyle

    #82076
    rely27
    Member
    Post count: 55

    Okay I’ve found the answer thanks to the plugin support, for those interested need to add this code in the function.php :

    function bk_set_jetpack_width() {
    	$content_width = 750;
    	return $content_width;
    }
    add_filter('jetpack_content_width', 'bk_set_jetpack_width');

    But now here is the tricky part, this work for a page with a sidebar as I can set a specific width but if use with a no sidebar page… I asked them and this is what he replied :

    Somewhere in your theme’s template, there is likely some if statements that pull from that sidebar setting and determine something different to happen (a change in classes for the CSS to pick up on, etc).

    Wherever your theme’s templates pull that option is likely the best spot for code like this.

    More about add_filter is at the Codex: http://codex.wordpress.org/Function_Reference/add_filter

    Basically, the 11 is the priority number of that particular filter. Without a number, it defaults to 10. Something at priority level 1 is filtered first, something at a higher number later.

    So, for example, how Jetpack’s Sharing buttons at the end of a post work via an add_filter(‘the_content’, “sharing_display’, 19)
    If you wanted to do something to the_content and have it happen before the Sharing buttons are added, you’d want to be sure to do it at a number lower than 18. If you want to do something later, you want a number higher.

    In our code above, the initial code that I suggested for functions.php doesn’t have a number, so it defaults to 10. In your case, since you have something special that you want to apply only in certain cases, we want be completely sure that the full-width number is used instead in those specific cases. To do that, we add priority level 11.

    So my guess is that somewhere in the page.php I have to add this code but not really sure where as I’m not really good at php (tried some different places but did not work…) Any help on this ?

    Thanks !

    #82161
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok I have forwarded this to the developer so that he can assist you with this

    – Kyle

    #82433
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Hi there,

    You can try using this code to alter your output:

    		global $sf_sidebar_config;
    		if (($sidebar_config == "left-sidebar") || ($sidebar_config == "right-sidebar")) {
    		
    
    		} else if ($sidebar_config == "both-sidebars") {
    
    		} else {
    
    		}

    Hope that helps!

    – Ed

    #82451
    rely27
    Member
    Post count: 55

    Hi Ed,

    But where do I insert this code, in function.php or page.php ?

    Thanks

    #82532
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    You’d add it to your functions.php file, like so:

    function bk_set_jetpack_width() {
    	global $sf_sidebar_config;
    	if (($sidebar_config == "left-sidebar") || ($sidebar_config == "right-sidebar")) {
    
    		// content width for one sidebar
    		$content_width = 750;
    		return $content_width;
    
    	} else if ($sidebar_config == "both-sidebars") {
    
    		// content width for both sidebars
    		$content_width = 750;
    		return $content_width;
    
    	} else {
    
    		// content width for no sidebars
    		$content_width = 750;
    		return $content_width;
    
    	}
    }
    add_filter('jetpack_content_width', 'bk_set_jetpack_width');

    That’s instead of the code you pasted above. I’ve added comments for you to see where to edit the various widths.

    Hope that helps.

    – Ed

    #83441
    rely27
    Member
    Post count: 55

    That work perfectly ! Thanks a lot for that !

    Romain

    #83444
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Great! Thanks Ed ๐Ÿ™‚

    – Kyle

    #101407
    roggggggg
    Member
    Post count: 2

    This worked for me, however is there any way to stop it reverting when I update my theme?

    Thanks ๐Ÿ™‚

    #101412
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Yes, add it to the child themes functions.php file

    – Kyle

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

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register