August 21, 2012 at 1:00 am #15549
I’m trying to add a custom section to my website to link to the same image galleries used by the Flashlight theme. However, I cannot see how the images are linked to each page in the database.
Example: I have a page with post ID 382 in my wp_posts table. I uploaded 10 images to the gallery for this page and they show up where they should on the site.
I look in the post_metadata table and the images are listed there, but with different post ID’s, not 382.
In the wp_posts table, I also see an entry for each of the images from the gallery, but they don’t say 382 anywhere in the record.
There is also a gallery record for the gallery, but it also does not reference 382 anywhere.
Can you tell me how the page is linked to the gallery? What fields do they have in common so that I can pull the correct images for a page?August 21, 2012 at 4:05 am #87936
I can’t be of much help. Devin or Dude though hopefully can. The two of them have been tagged to this thread.
MyaAugust 21, 2012 at 10:32 am #87937
The images are attached to a (hidden) post – if you’d like to change this behaviour you can follow Kriesi’s instructions here: https://kriesi.at/support/topic/image-tags-missing#post-32207
PeterAugust 21, 2012 at 4:49 pm #87938
Sorry to jump in here, but does this fix apply to product images as well? Also, what will happen to preexisting images if I make the change?
MikeAugust 21, 2012 at 5:27 pm #87939
ok, thanks Peter, I applied that change but I don’t think it quite resolves/answers what I was hoping it would.
Here is what I am running into:
I create a new page titled “Test Page”. In the wp_posts table, it is post_id 437.
Then I upload images to that page’s gallery section. It creates a new record in the wp_posts table as post_id 438. Now all images are linked to post_id 438, which is great, BUT…
I don’t see anything on post_id 437 linking it to the gallery under post_id 438. And the gallery record for post_id 438 doesn’t seem to reference post 437 either.
So if I want to write a PHP script to access the images associated with my test page (ID 437), how will my script know to use the gallery with the ID 438?
I just am not seeing where they are linked, but the theme knows how to associate them correctly, so they are obviously linked somewhere…
Please advise…otherwise I will need to write a whole new section bypassing the nice built in gallery, which seems a waste.August 21, 2012 at 6:41 pm #87940
ok, nevermind…I figured it out, based on the direction from your previous response. It seems I needed to edit a little bit more of the code to get the images to actually use the correct page ID.
In the class-htmlhelper.php file, I replaced this section:
if(empty($element) && empty($element))
$element = uniqid();
$id_generated = true;
$gallery_mode = true;
$postId = avia_media::get_custom_post($element.$element);
$postId = avia_media::get_custom_post($element);
$postId = $post_ID;
$gallery_mode = true;
Now it works as it should, but also keeps the original post ID attached to each image record and the gallery record in the wp_posts table.
Thanks for the help!August 22, 2012 at 6:24 am #87941
The topic ‘Flashlight images- how are galleries/images linked to pages in wordpress table?’ is closed to new replies.