Wordpress seems to be suppressing img title attribute - php

I am using a modified version of ContentFlow in Wordpress 3.9.1 . ContentFlow is a coverflow tool that generates a coverflow from a series of tags and their caption is created from the title=""-attribute.
I have a piece of php code that gets included to individual posts/pages via a template file and the insert php plugin, which runs just fine. It creates img tags that look like this:
<img class="item" src="http://www.path-to-the-image.com/001.jpg" href="http://www.path-to-the-image.com/001.jpg" title="001" id="" />
This all works fine. But when I let wordpress execute the script and render the image I get this:
<img class="item" src="http://www.path-to-the-image.com/001.jpg" href="http://www.path-to-the-image.com/001.jpg" id="">
As you can see the title tag is missing. And it seems to be specifically title tags. If I rename the title tag in php to e.g. "testtitle" I get flawlessly
<img class="item" src="http://www.path-to-the-image.com/001.jpg" href="http://www.path-to-the-image.com/001.jpg" testtitle="001" id="" />
So it seems Wordpress is suppressing the title tag by force. I have no plugins that should do this. Any ideas where the tag goes missing?
I have another installation running on the same server that does not have this issue, also running Wordpress 3.9.1

I found this on wordpress.org:
IMG Title Restore
WordPress 3.5 introduced a new feature – when images are inserted into posts, the title attribute is not included in the image tag. This was done with the best of intentions relating to accessibility, as documented on Trac
Unfortunately, this causes problems for some Lightbox plugins, quite apart from stopping image tooltips from appearing.
This plugin hooks into the media_send_to_editor filter and inserts the image title into the html inserted into the post.

Related

Embed iframe into a php file

I recently started a new position as a graphic designer for a local nonprofit. I have a little background in HMTL and CSS, but their website runs on PHP and I'm already struggling to work with the code.
I need to add an inline frame to embed a webpage within a specific page on our website. The programmers who built our site didn’t build a user friendly interface where we can embed HTML, so I'm told that I need to add the iframe snippet into the PHP for that page. However, the page I want to edit does not have it's own PHP file. It is a subpage under one of the site's main nav categories. I was able to find a PHP file which corresponds to that main nav category that this subpage falls under. I believe that this is where I would need to add the code. It appears to be a template which structures all of the pages inside of this broader nav category.
Can anyone help me with this? I'm not sure if you can just add HTML to a PHP file as is, or if it needs to be altered a bit. Also I need to know how I could have the PHP template selectively load the desired iframe only on the page that actually needs it - I don't want that iframe to appear in all the other pages that fall within the broader nav category.
The code I need to embed looks like this:
<iframe width="100%" height="800px" src="https://google.com" frameborder="0" scrolling="yes"></iframe>
you can use html as it is on php page.
point 2: you want to show iframe on specific page only...
e.g. on page xyz.php
<?php
$basename = basename($_SERVER['PHP_SELF']); /* Returns The Current PHP File Name */
if ($basename == 'xyz.php'){ ?>
<iframe width="100%" height="800px" src="https://google.com" frameborder="0" scrolling="yes"></iframe>
<?php } ?>

typo3 7: link image (if link is defined)

I am trying to output an image assigned to an extbase entity named "course" in a fluid template. This works fine, except I just don't know how to get the correct link if an image link was defined. What I tried is this:
<f:link.page pageUid="{course.image.originalResource.link}">
<f:image image="{course.image}"/>
</f:link.page>
This works, except when I define a target in the backend this is completely ignored - is there a different way aside from f:link.page or how can I link an image?
Starting from TYPO3 7.4 you can use typolink
<f:link.typolink parameter="{link}" target="_blank" class="ico-class" title="some title" additionalParams="&u=b" additionalAttributes="{type:'button'}">
Linktext
</f:link.typolink>

Wordpress Shortcode Auto-P Issue

I am new to Wordpress and am implementing a shortcode. My shortcode is super simple and the expected output is HTML5-compliant:
add_shortcode( 'my_code', function( $attributes ){
return '<div></div>';
});
When this gets emitted, I get the following HTML:
<a href="#">
<div></div>
<p></a>
As you can see, there appears to be auto formatting going on. I have followed the advice here, here, and have installed this plugin, all to no avail. I am looking for the magic secret that is making this formatting occur. Any assistance would be appreciated!
I cannot recreate the problem, after running the example i get the right output:
<div></div>
( the original HTML source, not the modified one that console shows, the HTML panel in console shows a live view on what the browser is showing )
The problem is when a shortcode output is wrapped inside paragraph, then the output is something like:
<p>Some text <div></div></p>
The blame for this broken HTML ( in HTML5 <div> inside <a> is permitted, but <div> inside <p> is not ) is on WordPress filter wpautop. That filter encloses text with <p> tag, replaces double line breaks with <p> tags, and single line breaks with <br /> tags. If the shortcode is right after the text its output will be part of the paragraph. To avoid that just put the new line between the text and the shortcode.
Some text
[my_code]
Some text
As I said I am a newb with Wordpress and I am learning the ropes here. It turns out the problem is due to a plugin. I deactivated all my plugins and the problem went away. So, lesson learned: if you have a really weird problem, disable plugins first to see if that is the source. Thanks to #Danijel for helping me out with this!
EDIT: FWIW, the plugin that causes this issue is this one (v1.0.18): https://wordpress.org/plugins/smpl-shortcodes/

magento product attribute with wysiwyg, src="{{media url="image.jpg"}} not parsed

Hi I'm working with Magento 1.7
I create a text area attribute with wysiwyg allowed and visible on the product page.
when I insert an image I can see only the html text of the attribute, images don’t appear.
If I analyse the generated html code, I can see that the code included by the wysiwyg editor like
src="{{media url="image.jpg"}}
has not been parsed.
The code I use is:
echo $ _Product-> getData ('technical_support');
I tried to print the attribute with
echo $this->helper('cms')->getBlockTemplateProcessor()->filter($this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($_technical_support), 'technical_support') );
But the attribute is not printed
How can I fix it?
Thanks for your help.
This is how u have to call the images through wysiwyg editor. You have to click show/hide button. Then u can write html tags there. Here is the example
<p class="home-callout"><img src="{{skin url='images/ph_callout_left_rebel.jpg'}}" alt="" /></p>
Flower brackets are missing in ur code.
And for attribute, your process is wrong.. Follow this link Calling an attribute in a CMS block in magento

PHP style the title problem

i am using a tool tip plugin that works by displaying the title attribute see this
i have a image with a title:
<img class="tiptip tip_top" src="adv.jpg" height="111" width="186" title="<?php echo $first; ?>"/>
if my php looks like this, it works:
$first = 'Check out the new diggs!';
but if i use styles it doesn't:
$first = '<span style="color:#f200c8;">Check out the new diggs!</span>';
any ideas how to use styles into php?
Your code is resulting in invalid HTML/CSS. You can't place style tags within a title attribute, only plain text. Your plugin should handle the tool tip's appearance. According to the documentation you linked to, you can modify the plugin's CSS.
Here is the HTML produced by the plugin:
<div id="tiptip_holder">
<div id="tiptip_content">
<div id="tiptip_arrow">
<div id="tiptip_arrow_inner"></div>
</div>
</div>
</div>
Those are the id's you should modify the CSS for, mainly tiptip_content.
You can't embed styles inside of an attribute like that. You need to find the class or ID values for the actual tooltip popup and modify those. The maker of the tooltip plugin might have some documentation to help you figure out what the classes he/she used are or you might be able to use Firebug (for Firefox) or the built in Developer Tools for Chrome to help you figure out the classes/ID.
The title attribute is not a HTML box. There should be only test values. If you want to display a styled title you should display it outside a image tag, for example something like this:
<img src="file.png" <!-- some other attributes --> /><br /><?php echo $title ?>
In this case $title can be a styled HTML text.
According to the spec, the title attribute expects to be the "text" type. This is explained elsewhere as
text that is meant to be "human readable"
HTML markup isn't meant to be human readable (it's meant to be machine readable), so the tags are parsed as plain text.

Categories