Debugs/errors in oqey gallery

Undefined Index The first and third are the same problem: if($_GET[‘type’] == “oqeygallery”){} and if(is_admin() && ($_GET[‘page’]==’oQeysettings’… Basically are: if ( $_GET[‘foo’] == ‘bar’ ) The problme is that $_GET[‘foo’] is not set. That is, the $_GET array does not have a ‘foo’ key. The solution is to wrap $_GET[‘foo’] in an isset() conditional: if … Read more

Showing a different gallery in a seperate post

You can try this function instead of your multi_gallery_shortcode(): function multi_gallery_shortcode($atts, $content=null) { extract( shortcode_atts( array( ‘pid’ => 0, ), $atts ) ); //format the input $pid = intval($pid); // construct a post object dependent on the input value if($pid>0){ // query a post object $pobj = get_post( $pid ); }else{ global $post; // current … Read more

Extracting gallery images in WordPress 3.5 on index.php

get_the_content is a template tag and would only work reliably inside a Loop. That means that you should also be able to use the $post global instead. global $post; // may not be necessary unless you have scope issues // for example, this is inside a function $post_content = $post->post_content; preg_match(‘/\[gallery.*ids=.(.*).\]/’, $post_content, $ids); $array_id = … Read more

How is a gallery associated with some post in database?

WordPress galleries are implemented as shortcodes: the shortcode should appear in the post_content of your “basic” post (whose post_type=”post”). The shortcode’s parameters specify the images to be included in the gallery by giving the post ID of the attachment-type post containing each image. So if you see two posts in wp_posts like this: id | … Read more

Help with WP gallery function, wrap gallery in div

I just added a div to your function see comment in code: <?php add_filter( ‘post_gallery’, ‘my_post_gallery’, 10, 2 ); function my_post_gallery( $output, $attr ) { global $post, $wp_locale; static $instance = 0; $instance ++; if ( isset( $attr[‘orderby’] ) ) { $attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] ); if( !$attr[‘orderby’] ) { unset( $attr[‘orderby’] ); } } … Read more

Pull Random Attachments With Pagination

Your since83_pagination() function is assuming the main query– $wp_query— but you are needing to paginate something very different. You need to be paginating the results in $attachments which you are retrieving with get_children(). That was my guess as soon as I saw this question. You are going to need to rethink this. There are two … Read more

Fancybox not working. why?

oh and the images work, but they link to the image itself and that’s it. Are you sure the images are showing with their links? Your PHP code did not work with me, I had to use this instead: $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘post_mime_type’=>’image’, ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, ‘post_parent’ => … Read more

In which version of WordPress was the new gallery shortcode implemented?

The file /wp-includes/media.php, where the Gallery Shortcode is defined, first appears in WordPress 2.5. It has the id (singular) attribute to refer to the post_parent: $attachments = get_children(“post_parent=$id … The ids (plural) attribute appears in WordPress 3.5, and is used to include attachments: if ( ! empty( $attr[‘ids’] ) ) { $attr[‘include’] = $attr[‘ids’]; } … Read more

Calling WP Gallery Uploader/Selector From Metabox

Figured out the answer to the question. file_frame.on(‘open’, function() { var selection = file_frame.state().get(‘selection’); var library = file_frame.state(‘gallery-edit’).get(‘library’); var ids = jQuery(‘#fg_perm_metadata’).val(); if (ids) { idsArray = ids.split(‘,’); idsArray.forEach(function(id) { attachment = wp.media.attachment(id); attachment.fetch(); selection.add( attachment ? [ attachment ] : [] ); }); file_frame.setState(‘gallery-edit’); idsArray.forEach(function(id) { attachment = wp.media.attachment(id); attachment.fetch(); library.add( attachment ? [ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)