Tag Info

Hot answers tagged

3

To add to the answer from @cristian.raiber, there is no function in Wordpress or php to detect screen sizes, and there will in all probabilty never be such functionality. Php runs server side, which runs before clients side which is browser side. As for php, and for that matter Wordpress, I cannot see any future implementation of any kind of function to ...


2

WordPress doesn't necessarily save a ton of gallery information in the database. Each time you upload an image ( or any media I believe ) it gets assigned to a built-in post type called simply "attachment" which gives it a unique ID. Whenever you go through the Media Library Popup and create a gallery, WordPress uses some javascript to generate a shortcode ...


2

WordPress actually uses a Built-in Post Type for Attachments ( called attachment ) so you can use some of the same functions like get_the_title() which is what you're looking for. Though, I did take some liberties by modifying your code below, using a foreach instead of a for loop: $gallery = get_post_gallery( 7, false ); // Attempt to get Post Gallery ...


1

This is my go to snippet for things like this. <?php add_action('print_media_templates', function(){ // define your backbone template; // the "tmpl-" prefix is required, // and your input field should have a data-setting attribute // matching the shortcode name ?> <script type="text/html" id="tmpl-my-custom-gallery-setting"> ...


1

No, there isn't such a thing at the moment. However, there is a solution you could try if you're really keen on this. This is something I've used in the past and it's worked out fine, although it has its limitations. The solution: You could write a small JS function that gets the user's current screen resolution and have it written to a cookie. You're ...


1

You can use the Custom URL field, to modify the attachment link for each one of your gallery images: where this is supported by the following plugin: <?php /** * Plugin Name: Custom Attachments Links * Description: Adds a new media field, to override the default attachment links. * Plugin URI: ...


1

If you want to display the attached image gallery, from another post, you can use: [gallery id="123"] where the custom id attribute is the post ID. If you want limit the number of items in a gallery, there seems to be a plugin available on wordpress.org called Limit parameter for gallery shortcode (no affiliation). It uses the pre_get_posts filter to ...



Only top voted, non community-wiki answers of a minimum length are eligible