PoetikDragon
Forum Replies Created
-
For future reference, I ended up copying this javascript file (except I removed the .widget-gallery from the selector) and added ‘no-carousel’ to the container div.
Hope this helps someone else! I’ve seen a lot of requests to disable Carousel on a single gallery and this was a breeze.
Thanks for that. Of course, I run into issues with Carousel. Do you know what class or attributes I could remove to prevent Carousel from activating on these image links?
Alternately… are the image sizes/positions calculated in php or javascript? To be honest I don’t really need it to be an actual gallery (with all the functionality of such), I just wanted the images to tile pretty and be random. If there is a function I could call in php with my own arguments that would be great.
Okay, I wrote a little function that uses regex on the shortcode to do what I want. I placed it in my theme’s functions.php file and call it from the archive page. It’s pretty hack-ish but it works. Would LOVE to hear there is a better way to achieve this!
$posts = get_posts( $args ); echo randomized_gallery_linked_to_posts( $posts );
function randomized_gallery_linked_to_posts( $posts ) { $attachment_permalinks = array(); $text_permalinks = array(); foreach ( $posts as $post ) { $args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'rand', 'numberposts' => 1, 'post_status' => 'any', 'post_parent' => $post->ID ); $attachments = get_posts( $args ); if ( $attachments ) { $attachment = reset( $attachments ); $attachment_permalinks[$attachment->ID] = get_permalink( $post->ID ); } else { // Fall back on text links if there are no images in the post at all $text_permalinks[] = '<h2><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></h2>'; } } $shortcode = '[gallery type="rectangular" ids="' . implode( ',', array_keys( $attachment_permalinks ) ) . '" orderby="rand"]'; $html = do_shortcode($shortcode); foreach ( $attachment_permalinks as $attachment_id => $permalink ) { $html = preg_replace( '/(<a href=")([^"]+)("[^<]+<img[^>]+data-attachment-id="' . $attachment_id . '")/', '$1' . $permalink . '$3', $html ); } return $html . implode( '', $text_permalinks ); }
I want to use an attached image at random. Of course, if you want to use only the featured image and have no text fallback it is even simpler.
You yourself pointed out that “they” tell you to keep your version of WordPress up to date. We’re on 4.2.2 now.
Forum: Fixing WordPress
In reply to: Error connecting to www.ads-software.com after plugin installI’m sorry to say (to future users who encounter this same problem) that I fixed it but I don’t know what the problem was. Restarting the server made everything work again.
Forum: Fixing WordPress
In reply to: Error connecting to www.ads-software.com after plugin installAdditionally (likely related) broken link checker is now telling me all links are broken and they’re not.
Forum: Plugins
In reply to: [Pods - Custom Content Types and Fields] How to use custom menu locationResolved! Please disregard.
I figured it out by looking through the pods code and discovering that it called the function add_submenu_page with the “custom menu location” as the first argument. Then I checked the wordpress docs and found I needed it to be something like
edit.php?post_type=your_post_type
. This did the trick.WordPress docs here:
https://codex.www.ads-software.com/Function_Reference/add_submenu_pageA help note in the pods admin for this would be appreciated.
That did it, thank you! It’s not explicitly stated in the docs, maybe it should be?
Forum: Themes and Templates
In reply to: [Sorbet] Submenus don't work on iPadIn order to prevent DoubleTapToGo from being active on smaller screens which use the responsive menu layout, I changed the javascript to this:
if ($(".main-navigation ul ul").css("visibility") == "hidden") { $(".main-navigation li:has(ul)").doubleTapToGo(); }
Forum: Themes and Templates
In reply to: [Sorbet] Submenus don't work on iPadI found a temporary solution.
I added doubletaptogo.js from here:
https://osvaldas.info/drop-down-navigation-responsive-and-touch-friendlyAnd a single line of script in my page:
$(“#menu-main-navigation li:has(ul)”).doubleTapToGo();When you chat with the devs, they may wish to implement this. It is a very tiny and straightforward script. ??
Forum: Themes and Templates
In reply to: [Sorbet] Submenus don't work on iPadHuzzah! Glad its not just me, I’ll sit tight for any helpful info. ??