Jump to content


Photo
- - - - -

$content_width support?

jetpack gallery width

  • Please log in to reply
29 replies to this topic

#21 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 09 June 2013 - 03:40 PM

Most people simply don't read the docs properly for $content_width. Hopefully I can clear this up easily.

 

$content_width is a GLOBAL variable that themes and plugins can use to control media. We dont set it in PageLines, we leave it up to the user.

 

James was almost there with his example:

Please Login or Register to see this Hidden Content

Here he is setting a var, but it isn't globalised so nothing can use it.

 

So lets assume for an example you have a page width of 1200px with a 800px content area and 200px sidebar... and you want the gallery to fit nicely in the content area..

Please Login or Register to see this Hidden Content

OK what about if you have a full width page?

Please Login or Register to see this Hidden Content

Get the idea?

Better yet, how can we make this use the settings from the layout editor? There are a bunch of functions added long ago in this file: 

Please Login or Register to see this Hidden Content

 

So on my full width test page here: 

Please Login or Register to see this Hidden Content

To get the gallery to use the proper width i used this in my child theme functions:

Please Login or Register to see this Hidden Content


  • CliffordP and Erwan like this

#22 beardedavenger

beardedavenger

    Unicorn Wrangler

  • Members

  • 1219 posts
  • Country: Country Flag

Posted 09 June 2013 - 04:06 PM

You can also use a LESS approach since those are also LESS variables. This works for @pl-content-width, and @pl-page-width. Note however, this does not account for padding.

 

EX:

 

.some-div (@pl-content-width) when (@pl-content-width < 500) {
 do something with your less
}


#23 Denis Ciumbargi

Denis Ciumbargi

    Advanced Member

  • Members
  • 66 posts
  • Framework Version:DMS Pro
  • Country: Country Flag

Posted 09 June 2013 - 07:33 PM

Hi and THANK you all for the answers.

 

I mean no disrespect to any developer, programer, administrator, moderator when i post my posts. I totally get their jobs.

 

The last two answers, from @

Please Login or Register to see this Hidden Content

and @

Please Login or Register to see this Hidden Content

bring more. This helps but again, with the risk of look stubborn, the problem is another one.

 

I CANNOT DEFINE TWO WIDTHS. I WOULD LIKE TO HAVE A WIDTH AUTO DECLARED AS I WOULD NOT HAVE TO CHOOSE THE GALLERIES TO BE ONLY ON 800 PX WIDE PAGER OR JUST 1200. I WOULD LIKE TO HAVE THE OPTION TO PUT A GALLERY ON ANY WIDTH THE PAGE MIGHT HAVE WITHOUT HAVING THIS ISSUE.

 

Declaring a 1200 px and to insert my gallery on a 800 px wide page will create content that is partially hidden. IF ONE CONTRIBUTOR CREATES AN ARTICLE THAT IT'S TEMPLATE IS 800 PX AND WANTS TO ADD A GALLERY HE WOULD HAVE TROUBLES SHOWING IT'S CHOSEN CONTENT FOR THE GALLERY. IT GOES THE OTHER WAY AROUND ALSO.

 

it is one thing for me if i would be the only contributor / author and i would know that i have to create galleries only on 1200px wide pages but is different when you are creating a community site with simple contributors.

 

That was my problem.

 

I do know is hard to create a product that everyone can use with no troubles and i feel sometimes guilty that i have to ask this kind of questions here on the forum.

 

And more minds are better than one. Ok. Maybe i am the only one at the moment asking for this. But i might not be the last. It is better to have this with an answer that will please the future also.

 

Anyway...Thanks, i do appreciate the answers.



#24 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 09 June 2013 - 07:54 PM

All pages are the same width though?

 

If you set the layout in the admin layout editor, then use this the content width is set for you:

global $content_width;
$content_width = pl_page_width();

 

How are you setting different widths for different pages?

 

Im having trouble reading your posts, are the bits IN CAPS questions?



#25 Denis Ciumbargi

Denis Ciumbargi

    Advanced Member

  • Members
  • 66 posts
  • Framework Version:DMS Pro
  • Country: Country Flag

Posted 09 June 2013 - 08:29 PM

@

Please Login or Register to see this Hidden Content

 

I have different widths for pages.

 

There 2 types of widths. Full width and one sidebar pages that off course the content area has different width.

 

Full width pages are defined on 1000 px including the padding, the one sidebar have the sidebar set at 200 px and the content of the page 800px with paddings included.

 

Most of the articles will be on 800 px pages. Most of the articles, as being a NGO community website will have content that will require lots of images and i have chosen jetpack as it has so many features nicely integrated into wordpress core and are less likely to cause conflicts with other plugins. The full width pages will have content that is intended for super exposure for visitors and again, some of them will need to have galleries.

Contributors and Authors will understand in time the coding needed but most of them are just people with stories that all they know is to drag and drop images, choose the gallery option and write text. They are less likely to contribute if i put pages like, use only that template with that plugin with that setting on. I have to offer just the option where they can put what they need to put and me handle the battle with coding even if i am not that good myself. That is why i am trying and being stubborn to define a width that will make the galleries, even if it such a small thing for some, look good.

 

The caps are things that are more important in context not necessarily questions.

I know, lots of text outside the context but, might help better understand the customers you have :)



#26 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 09 June 2013 - 08:50 PM

So are you going to have galleries on full width pages and sidebar pages?
 

The caps are things that are more important in context not necessarily questions.

I think you mean bold



#27 Denis Ciumbargi

Denis Ciumbargi

    Advanced Member

  • Members
  • 66 posts
  • Framework Version:DMS Pro
  • Country: Country Flag

Posted 09 June 2013 - 09:10 PM

@

Please Login or Register to see this Hidden Content

yes, galleries on both types of pages, full width and one sidebar pages.



#28 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 09 June 2013 - 09:30 PM

Well where you set the variable your going to have to add some logic...

 

lets say page id 100 is full width and all others have a sidebar...

Please Login or Register to see this Hidden Content


Edited by Simon_P, 09 June 2013 - 09:32 PM.
corrected logic


#29 mikezielonka

mikezielonka

    #1 Fatboy

  • Members

  • -221 posts
  • Country: Country Flag

Posted 13 October 2013 - 10:20 PM

@

Please Login or Register to see this Hidden Content

think this is worth a GH issue for DMS?



#30 Danny

Danny

    Is Awesome!

  • Moderators
  • 15047 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 14 October 2013 - 09:32 AM

@

Please Login or Register to see this Hidden Content

think this is worth a GH issue for DMS?


Why ?





Also tagged with one or more of these keywords: jetpack, gallery, width