With the code here, it gives random pictures to the subjects, I want to make that picture a single picture, what should I replace this code with?
<div class="forum-symbol" role="img" aria-label="{$forum['name']}" style="background-image: url('{$forum['v7_modern_asset_url']}/images/forum/{$forum['fid']}.png')">
what should i replace this code with
I think this is inside a loop
you need to give the image URL an absolute path
eg.
<div class="forum-symbol" role="img" aria-label="{$forum['name']}" style="background-image: url('/folder/image-name.png')">
I hope this helps
Related
In my project's homepage there must be some images, these must link to other pages. Now, I want to manage these links in an automatic way using PHP. The only idea I came up with is to make a form and insert the images into some buttons and make their background invisible.
<div class="container">
<div class="row">
<div class="col-md-4">
<h3>FRESH ALBUMS</h3>
</div>
</div>
<div id="myline"></div>
<div class="row">
<div class="col-md-3">
<img src="contentimg/abbeyroad.jpg" height="200px" width="200px">
<div class="caption">
<h4>Beatles</h4>
</div>
<p> test</p>
</div>
<div class="col-md-3">TEST2</div>
<div class="col-md-3">TEST3</div>
<div class="col-md-3">TEST4</div>
</div>
</div>
This is the HTML at the moment. I just want to know if there are better ideas, options and if it will stay responsive. Thanks in advance.
I do not understand exactly what you are asking, but I cannot leave comments so I will try to answer what I think you are asking.
For the HTML part, you don't need a form with buttons, you can make hyperlinks out of the images instead, and the PHP can get the images to match the hyperlinks when it sends the page to your users browser. The PHP code would look like:
echo "
<a href='".$newPageLink."'>
<img src='".$imageLocation."' width='100px' height='100px'>
</a>";
Where $newPageLink is a variable in your PHP script that holds the path information for your hyperlink, and $imageLocation is the path information for where the image is stored.
All you need is a foreach or while loop to go through all of the images that you want on the page and also all of the pages that each image should link to. If it is always a manageable and unchanging list, you could store the values in an array in your script. For larger lists, or lists that are dynamic/always changing you might need to use a MySQL database table to store the image and hyperlink information.
I have searched high and low for a solution to this. I want to change the markup of an uploaded image in WordPress from this:
<div id="attachment_906" style="width: 590px" class="wp-caption aligncenter">
<img class="size-full wp-image-906 " title="Image Alignment 580x300" alt="Image Alignment 580x300" src="http://localhost/sandbox/wp-content/uploads/2013/03/image-alignment-580x300.jpg" width="580" height="300">
<p class="wp-caption-text">Look at 580×300 getting some <a title="Image Settings" href="http://en.support.wordpress.com/images/image-settings/">caption</a> love.</p>
</div>
To something more like this:
<figure class="center">
<img class="gallery-img" src="http://lorempixel.com/300/500/">
<figcaption>
<span>A slightly longer caption for the image, which is significantly smaller than the last one. pretty neat!</span>
</figcaption>
</figure>
I understand that much of the markup in the original post needs to stay, but is there any way to customize any of this? Even if I could get the same basic structure (a wrapper, the image, a caption wrapper, the caption) I could take it from there with CSS.
Since I'm developing a theme, I need the options to work with the native WordPress tools. If that isn't the case, I can't work with it.
I had hoped that there would simply be a filter or action that I could apply to do this, but I have had no luck in finding such a thing.
Thanks in advance!
You need to use the image_send_to_editor filter. https://developer.wordpress.org/reference/hooks/image_send_to_editor/
That could look something like this in any one of your active theme or plugin's php files (like functions.php);
function filter_image_send_to_editor($content) {
$content .= '<figure class="center">(Generate your markup here)</figure>';
return $content;
}
add_filter('image_send_to_editor', 'filter_image_send_to_editor');
You'll have to write your own code inside that function, of course.
I have a quite specific problem to solve today - I just can't get my head wrapped around it. Makes totally no sense for me...
It's about a live site: http://rawrockchick.com/#testimonial-slider
If you scroll down to the testimonials on the home page (the link above should bring you there) you'll see that the slider arrows are missing. For a reason I can't figure out the URL is prepended a couple of times before the image src:
<img src="http://rawrockchick.comhttp://rawrockchick.comhttp://rawrockchick.com/media/manual/slider-arrow-left.png">
This wasn't the case two weeks ago, without anybody consciously touching it. I first thought of some Javascript thing happening with the bootstrap slider, but as you can see the testimonial image itself is not affected, even though it's placed in the exact way as the sliders are.
The whole slider is a very simple bootstrap carousel. Excerpts (relevant section) of the code:
<div class="item active">
<div class="row">
<div class="col-sm-8">
<p>"An up-and-coming UK raw food teacher and songstress, Barbara Fernandez has it going on! This girl can do food prep! Her Raw Mexican food is amazing"</p>
<p class="testimonial-author">Nomi Shannon</p>
<p class="testimonial-role">rawgourmet.com</p>
<a class="left carousel-control" href="#testimonial-slider" data-slide="prev"><img src="/media/manual/slider-arrow-left.png"></a>
<a class="right carousel-control" href="#testimonial-slider" data-slide="next"><img src="/media/manual/slider-arrow-right.png"></a>
</div>
<div class="col-sm-4">
<img src="/media/test-nomi-150.jpg" class="img-responsive hidden-xs hidden-sm img-circle" style="margin-left:25px;">
</div>
</div>
</div>
As you can see the images are inserted the exact same way.
What I tried already (no change):
I moved the <img src="/media/manual/slider-arrow-left.png"> out of the link and placed it directly under the working image, the same strange behavior occurs for the slider arrow (by this test I wanted to make sure there's no jquery rule affecting only that one column of the slider, or the a tag).
Hardcoding absolute image URL (src="http://rawrockchick.com/media/manual/slider-arrow-left.png")
WordPress PHP query for image URL (src="<?php echo home_url(); ?>/media/manual/slider-arrow-left.png")
I'd be very thankful if anyone had any ideas about that phenomena. Or idea how to debug it further.
I am not really sure why you are getting a double URL but using an absolute path to your image could help solve things.
<img src="<?php echo home_url(); ?>/media/test-nomi-150.jpg" class="img-responsive hidden-xs hidden-sm img-circle" style="margin-left:25px;">
Solved.
Found it out via disabling plugin for plugin that a Pinterest hover button plugin (this to be precise) was causing that mysterious phenomena.
Thanks for all the answers and hints!
Hi i am trying to get an image to display when a result is picked from a data base this is my code below:
$box .= '<div style="margin-top:10px;height:120px;"id=\"Video\">
<br/>
<div style="border-style:solid;border-width:1px;border-color:#00000;width:400px;float:right;"id=\"Title\">'.$row['title'].'</div>
<div style="width:220px;height:150px;float:left;border-style:solid;border-width:1px;border-color:#000000;" id=\"VideoImage\">"
<img class="partimg1" src="classroom/images/'.$row['media_id'].'.jpg" /></div>
<div style="height:50px;width:400px;float:right;padding:2px;margin-bottom:5px;" id=\"Blurb\">'.$row['blurb'].'</div>
<div style="height:21px;width:152px;margin-top:45px;margin-left:7px;background:url(images/bg_top_img2-09.jpg) repeat-x;color:#ffffff;padding-left:2px;float:left;border:1px solid #000000;position:relative;border-radius:15px;text-align:center;" id=\"Downloads\"> Download </div>
</div>';
the line with in the middle is where the image should be the .$row['media_id']. this will be a value from the database it will only be a number so for example 1 up to 50 and in the images folder the images are named 1 to 50 and they are all JPG is there something that i have missed because i have used this before and it worked.
all that displays on the screen is a broken image link like when the web page cannot find the image in the folder.
any help would be much appreciated.
You break the src link.
src=\"classroom/images/'.$row['media_id'].'.jpg\"/>
As you use simple quote ' for string delimiter, you don't need to escape double ones "
<img class=\"partimg1\" src=\"classroom/images/"'.$row['media_id'].'".jpg\"/>
Should be
<img class="partimg1" src="classroom/images/'.$row['media_id'].'.jpg" />
You also need to fix all your id attributes
I have a portfolio page with small boxes with a image and link.
This seems (after struggling in code) to work, but the image don't work.
For each porject on the portfolio page:
[[!Gallery? &album=`[[+tv.gallery]]` &limit=`1` &thumbWidth=`870` &thumbHeight=`400` &thumbZoomCrop=`2` &toPlaceholder=`projecten`]]
<li class="[[dynamicWidget]]" id="[[+tv.category]]">
[[!+projecten:notempty=`
<div class="item">
<a href="[[~[[+id]]]]" title="[[+description]]">
<img src="[[+projecten.image]]" alt="[[+description]]" />
</a>
</div>
`]]
</li>
( i'm using the default gallery function)
thetv.gallery is the id of the gallery wich i like to use, but now i takes only the first album, not the first picture of a project.
It works, but only the selected image is not the album's first item (tv.gallery) but the first or second image in that album.
So:
- i have 2 pages with each a gallery witht to images
- the code gives me the first album with picture 1 and picture 2.
How to solve this, please give me some advice because i really want this script to be finished. thanks
Not sure if I understood exactly what you want to do, but maybe you should be using the GalleryAlbums snippet in this case, in combination with the albumCoverSort option.
edit: based on your comment, it looks like Gallery might be the best choice:
[[!Gallery? &album=`myProject` &limit=`1` &sort=`rank`]]
Refer to the docs for more info about how to sort the thumbnail shown.