I am attempting to create custom field that allows users to login into wordpress dashboard > edit post > upload a pdf > and after publish the post; which will then have a working 'download PDF' button.
I have created the custom field and the option is there to toggle 'PDF' and attach a PDF document. The button appears as it should after publish -- but upon clicking the link doesn't work. Below is my added code that should be working for this functionality. Any suggestions?
<?php $pdf_val = get_custom_field('pdfdoc:get_post','guid');
if($pdf_val){ ?>
<div style="text-align: center;"><button class="downloadBtn" style="color: #ffffff !important;"><span style="color: #fff !important;">Download PDF</span></strong></button></div>
<?php } ?>
Also it is to be noted that within the source, the a tag is actually being populated with the PDF file! But the click doesn't fire? =/
The answer was.. for those who may be interested..
Removing of <button> wrapping the <a> tag.
Related
I am using Drupal 8 and i created a page where i display an image and a form inside a block as an inline template.
This looks like this :
<div class="col-md-6" style="padding-right:0px; padding-left:0px;">
<img src="{{ base_path ~ directory }}/sites/default/files/Dinard_S.jpg" id="b-frm-img" style="width: 400px; height:300px;"></div>
Then another div contains my form. What i'm trying to do is to make user with no code knowledge able to change this specific image from the drupal admin.
Is there any way to do this?
I created an admin page to upload an image in a dedicated folder using managed_file type in the form. Seems there is no better ways.
My friend has asked me to help them move images around on their wordpress site. They have an image slideshow that runs along the bottom of the page and the image gallery that shows, depends on the page template used.
One template has the following code:
<?php
$tagu = get_post_meta($post->ID,'bototm_gallery');
?>
<div class="flt box_bottom">
<ul style="margin-left:10px !important; width:100% !important;" class="sub_photo sub_photo_gigs" class="sub_photo">
<?php echo do_shortcode($tagu['0']); ?>
</ul>`
and another page template shows this code:
<?php $tagu = get_post_meta($post->ID,'bototm_gallery'); ?>
<div class="flt box_bottom">
<div class="sv_footer_photo">
<?php echo do_shortcode($tagu['0']); ?>
</div>`
How do I add images to a specific gallery? I can't find a gallery id in the media library and/or I don't know where to find the class such as sv_footer_photo or sub_photo.
Could you please explain it to me?
Oh Wow, I've found it and sure enough it was simple.
I had to click on 'Screen Options' at the top of the page, tick the box for custom fields and then I can see the gallery image ids assigned to that page.
I am using the jQueryUI dialog modal like this:
<div id="dialog-modal" title="Basic modal dialog">
<img src="#" alt="Pictures" />
</div>
I have a PHP foreach loop that displays three image icons at any given moment. The image urls are in a MySQL database. The images themselves are contained inside anchor tags, and shown as a thumbnail. The <a> contains a class called "theLink". jQuery knows to open up the dialog when you click on "theLink" (in essence, clicking on the pic).
My hope is to allow the image to be shown much larger than a thumbnail by clicking on it. And then it will dynamically transfer the image link to the modal dialog where it will be shown. So again, one modal dialog div (as seen above) just under the <body> tag. This is what I am looking for:
When you click on "theLink" it will take the PHP generated image link from the img and use it to replace the "#" in the modal div.
<a> <img src="PHP GENERATED" /> </a>
I figured out the answer by getting jQuery basics down.
I had to create a class called ImageLink in the image that is php generated. I had to use a class, not an ID because this class would be repeated three times as I have three thumbnails displayed at a time.
Keyword 'this' was important so I can point to the specific imageLink class.
<a><img src="PHP GENERATED" class="imageLink" /></a>
Then, in jQuery:
var realImage = $(this).find('.imageLink').attr("src");
$('#popUpImage').attr('src', realImage);
$('#dialog-modal').dialog('open');
I am using drupal 7
views-view--myview.tpl.php sample code
<?php if ($rows): ?>
<?php print $rows; ?>
When i see this in firebug i see the structure
<div class="item-list">
<ul>
<li class="views-row views-row-1 views-row-odd views-row-first"> </li>
<li class="views-row views-row-2 views-row-even "> </li>
Now how do i inject a div in each of these li.. Is this possible without using jquery?
If you go the the "Edit" page for the view, you should see a link called "Theme: Information". It's under the "Style Settings" section. If you click this, you can see a list of all the possible template that your theme will look for when displaying the view. In bold will be the file it is currently using.
views-view--myview.tpl.php is to high up the chain to do what you want. If you want to inject a div (the same div) around each field you output, then I think the file views-view-field.tpl.php is what you are looking for.
The file contains just the line
<?php print $output; ?>
So there you can insert the desired div (after you copy it from views/themes into the template directory for your theme, of course).
If you investigate the Theme Information link some more it describes how to be even more specific in naming the view template files, for example if you wanted to theme a specific row differently you could use the file views-view-field--entity-id-X.
Hope that helps!
EDIT for comment
To go a different route, you can also edit the field settings for your view. Under the Field tab on the edit view page, you can click the links for each field. There is a Suffix setting available you could use to inject a div after the field is displayed.
I was wondering...if any coding expert out there could spare a few minutes to help me out with a tiny problem? It's something to do with the alt image text.
You see, whenever I upload an image, the alt text for it doesn't display properly. You can have a look here --> http://buywerewolfcostume.com/. This is how it's displaying in the source code:
alt="Female-vampire-small.jpg"
alt="side_farm_trap_1.jpg"
How do I get it to display like this -
alt="Female Vampire" and alt="Side Farm Trap"
I tried installing a special Alt image plugin, (the site is built on a Wordpress platform) but that didn't work. I also tried editing the image settings but that didn't work either. Is there a special line of code I should add to the CSS stylesheet?
Btw, here is the image code in my stylesheet:
.images img {padding:0 13px 0 0;}
.images img.last {padding-right:0;}
I'd really appreciate it if anyone out there could please offer some advice...
in your index file where is says
<div class="images" style="padding-top:10px; "><?php get_images(); ?></div>
You might as well just replace with your images and then you can make the alt tags what ever you want.
<div class="images" style="padding-top: 10px;">
<img alt="Female Vampire" src="http://buywerewolfcostume.com/wp-content/uploads/Female-vampire-small.jpg">
<img class="last" alt="Side Farm Trap" src="http://buywerewolfcostume.com/wp-content/uploads/side_farm_trap_1.jpg">
</div>
This is a simple matter in html:
<img src="side_farm_trap_1.jpg" alt="Side Farm Trap" >
Edit after retagging: Does Wordpress hide the option to add alt text or a title to images?
Not sure I totally follow, but does this work for you?
<img src="Female-vampire-small.jpg" alt="Female Vampire" title="Female Vampire" />
The Alt tag is for when the image is for some reason NOT there. The alt text will show up in it's place
The Title tag is displayed as a tooltip in the browser
Note: IE used to display the Alt tag as a tooltip as well, but it no longer does.
When you upload an image via WordPress, put the text you want to show up as 'alt text' both in the "Title" field and in the "Alternative Text" fields. Then click the "Insert Into Post" button.
Here's a video about uploading an image via the WordPress interface. In this video the "alternative text" field is called "caption". In newer versions of WordPress, "caption" and "alternative text" are separated out into different fields. The "caption" field shows up as a caption underneath your image; the 'alternative text' (or 'title') field is what shows up on hover/mouseover. Experiment to see what works best for you.
http://wordpress.tv/2009/01/05/embedding-photos-video-audio-into-your-posts/
Best of luck!