Logic to display the correct selected thumbnails? - php

I am using Wordpress - I am wondering if it could work with posts'feature images and links as content?
In form, there would have brochure images (PDF thumbnails) with checkboxes. The user will select one or more thumbnails. On thank you, there would be correct selected thumbnails for the user to download pdf files.
So how to have posts display with checkboxes and then on thank you, how to display correct ones with links wrapped around them?
the help or insight would be appreciated. The image can help u to see what I am trying to achieve:
OR we do static things - how do I get the checkbox selected then display the correct pdf?

My idea, not very dynamic:
upload the pdf
copy the url of the pdf
make a new post (maybe create a custom post type for this)
paste the pdf url in a 'custom field'
add the featured image to the post
publish the post
on the frontend
query all posts which have a pdf on them.(based on posttype/tags/category whatever)
Make a list
show the featured image (you know how)
save selection on post ID (on submit)
show selection on post ID , get both the featured image and the pdf link.
Not the most graceful solution but that's how I would do it.
I would use a custom post type. Since the post doesn't need an title or body(text)

Related

How to make an image selector for specific content

When creating a new page I want to select an image from a gallery of all images previously uploaded. I've tried searching for a solution for a few hours but can't seem to find any good answers. I already know how to upload and display the images to a gallery from the database.
What I don't know is how to make it so you can select an image and assign it to that page/content.
It's not something that happens automatically. You have to code it.
The algorithm would look something like this:
Display thumbnails with the url/id of the full size picture (see Creating a thumbnail from an uploaded image);
On click, add the url of the picture you want to use on that page.

How to find Url for uploaded Icon in Post Category

I set up an advanced custom field to add a category icon by uploaded an image to a post category. It seems to function but I don't have the right PHP target to pull the image URL.
How do I write this correctly?
I haven't tried any direct solutions besides playing around with PHP that I don't really know.
<div class="cat-icons"><img class="category_icons" src="(<?php
the_field('category_icons');?>)"></div>
Front end output displays this when I inspect element:
<div class="cat-icons"><img class="category_icons" src="()"></div>
Display uploaded image.
Example webpage:
http://xh3.afa.myftpupload.com/hall-of-fame/

Adding Custom post type title to attached images caption attribute in Wordpress

I trying to resolve an issue that a friend of mine is having with an image heavy Wordpress site.
The site has multiple Custom Post Types and each Post Type has custom fields that allow multiple images to be uploaded.
The problem i'm trying to solve is this; The site has around 40,000 images, most of which are attached to the custom posts mentioned above, these images are used to showcase properties and are combined into preview pages to show to potential clients. Locating the correct images is difficult and i need to add some custom meta data to the images so make them easier to group/navigate.
Ideally i need to add the attachments parent post title into the alt or caption attributes for every image on the site.
Theoretically this would be done by using a default hook to add_filter('foo... I'm just not quite sure how to structure this so that it can run through all old images and future images.
A nudge in the right direction would be very appreciated.
WP_Image_Editor objects that you can perform operations on:
wp_save_image_editor_file
image_editor_save_pre
wp_save_image_editor_file
wp_image_editor_before_change
the first hook is triggered when an image is edited (crop/re-size whatever)
the second one is triggered when you crop/rotate the image and press the Save button (and it's a pre-filter)
for the 3rd one it is important to note that you should use $image->save( $filename, $mime_type ); inside your callback, or you will be left with an image that doesn't get saved. And if you want to do so, then better don't return the $saved with no value/NULL.

How do I make a gallery in WordPress without using a plugin?

I have created a gallery in a WordPress post using WordPress's native media gallery and it shows me the images as gallery thumbnails in rows and columns which is exactly what I want.
But when I click on any of the thumbnail it opens the direct image link. I want that the image should be shown in my blogs environment. I would actually want it to show on the same page itself. but if not that I don't want it to open as a direct image. Is there a template file or something I could make for opening those images. I think image.php, but I have no idea how to go about it.
Help..?
Thanks
When you're inserting a gallery into your post, you can select how to link to the images. See screenshot: http://cl.ly/2yYA
Just select 'attachment page' and you'll get an individual page with commenting for that photo. Is that what you were looking for? You can edit the template of that page using attachment.php.

JS Lightbox for pictures which I want to link to the article the picture is from

I'm using WordPress as my CMS and I just downloaded a Lightbox plugin for a photo gallery on one of my pages. It works exactly how I want it to, except for one thing.
After clicking on a thumbnail to get the photo enlarged with a lightbox effect, I want to be able to click on a link to take me to the main article where that picture is from.
I've tried a few ways but the issue which arises is that I can't pass < ?php the_permalink(); ?> through a JavaScript function. How would I go about to accomplish this?
Thanks to anyone who can help!
The only way to do it is have the image link go to some inline content, which contains the image wrapped in the this is the only way. The lightbox website will have examples of linking inline content, but for every image you will need to generate the inline content, this is the limitations of using a plugin.
If I were in your shoes, I would write a custom modal function, which would take the permalink from an attribute of the image (rel, title, class) and display the larger image linked to the permalink. I am sure you can find a custom modal tutorial, but basically you create a box in your css, which is set to display:none, then when your link(s) is/are clicked, you use jQuery to append one of the boxes to body, append your content into the box, then display it in the center of the screen, using absolute positioning, and opaque to dull everything else.

Categories