I am trying to add a word to my numbered list. I want to put the word 'STEP ' before the number. I have seen many answers on how to add it in using CSS and counters (like this: How can I prefix ordered list item numbers with a static string using CSS?), but my list is in a generated email. Is there a way to do it inline?
This is my code:
public function createForgotPasswordEmail($transcriberEmail, $newpassword) {
$attachments = $this->setForgotPasswordAttachmentImages();
$htmlBody = '<h2>Seven steps to reset your password</h2>';
$htmlBody .= '<span style="background-color: yellow;font-weight: bold;">Please follow the 7 steps below carefully to reset your password.</span><br>';
$htmlBody .= '<br>This is a <u>one-time use</u> password. If not used within 72 hours, it will expire and you will need to request another temporary password.<br><br>';
$htmlBody .= '<ol><li><strong>Log out of the template manager</strong> (right click on the template manager in the task bar and choose Exit from the menu).</li><br />';
$htmlBody .= '<img src="cid:exit_from_template_manager.png" width="325" height="149"><br /><br />';
$htmlBody .= '<li>Copy the password below (highlighted in yellow) and use it to sign in to your account on ###.';
$htmlBody .= '<ul><li style="list-style-type: none;padding-top:5px;padding-bottom:5px;">Password: <span style="background-color: yellow;">' . $newpassword . '</span>';
$htmlBody .= '</li></ul></li>';
$htmlBody .= '<br /><img src="cid:log_in_to_###.jpg" width="185" height="175"><br /><br />';
$htmlBody .= '<li>Once you log in, you will be prompted to change your password. ';
$htmlBody .= 'A message will appear in red at the top left of the ### page if your password was changed successfully.</li>';
$htmlBody .= '<br /><img src= "cid:password_successfully_changed_message.png" width="190" height="309"><br /><br />';
$htmlBody .= '<li>You will now be automatically logged out. Please log in again using your new password.</li>';
$htmlBody .= '<li>Update your password manager with your new password, if you use one.</li>';
$htmlBody .= '<li>Log in to the template manager using your new password.</li>';
$htmlBody .= '<br /><img src="cid:login_to_template_manager.png" width="361" height="298"><br /><br />';
$htmlBody .= '<li>If you use a separate password manager for the template manager, update your password there too.</li></ol>';
$htmlBody .= '<br><br>Thank you,<br>###';
$data = [
'From' => '###',
'To' => $transcriberEmail,
'Subject' => 'Your temporary ### password',
'Tag' => 'temporaryPasswordSent',
'HtmlBody' => $htmlBody,
'Attachments' => $attachments
];
$emailClient = new emailClient();
return $emailClient->sendEmailWithInlineAttachments($data);
}
Just to be clear, I want to output:
STEP 1. Log out of the...
STEP 2. Copy the...
Related
I'm trying to replace the default image html output in WordPress editor with responsive images picture tag.
I created a custom function that replaces the default img html and hooked it into editor via image_send_to_editor filter:
function mystic_responsive_insert_image($html, $id, $caption, $title, $align, $url) {
$image_url = wp_get_attachment_url($id);
$attachment_id = attachment_url_to_postid( $image_url );
$alt_text = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
if ( !$alt_text ) { $alt_text = esc_html( get_the_title($post_id) ); }
$thumb_xl_hpt1 = wp_get_attachment_image_src($attachment_id, 'xl-thumb-hpt1');
$thumb_lg_hpt1 = wp_get_attachment_image_src($attachment_id, 'lg-thumb-hpt1');
$thumb_md_hpt1 = wp_get_attachment_image_src($attachment_id, 'md-thumb-hpt1');
$thumb_sm_hpt1 = wp_get_attachment_image_src($attachment_id, 'sm-thumb-hpt1');
$thumb_xs_hpt1 = wp_get_attachment_image_src($attachment_id, 'xs-thumb-hpt1');
$thumb_xl_hpt1_2x = wp_get_attachment_image_src($attachment_id, 'xl-thumb-hpt1-2x');
$thumb_lg_hpt1_2x = wp_get_attachment_image_src($attachment_id, 'lg-thumb-hpt1-2x');
$thumb_md_hpt1_2x = wp_get_attachment_image_src($attachment_id, 'md-thumb-hpt1-2x');
$thumb_sm_hpt1_2x = wp_get_attachment_image_src($attachment_id, 'sm-thumb-hpt1-2x');
$thumb_xs_hpt1_2x = wp_get_attachment_image_src($attachment_id, 'xs-thumb-hpt1-2x');
$thumb_data = array(
'thumb_xl_hpt1_2x' => $thumb_xl_hpt1_2x[0],
'thumb_large_hpt1_2x' => $thumb_lg_hpt1_2x[0],
'thumb_medium_hpt1_2x' => $thumb_md_hpt1_2x[0],
'thumb_small_hpt1_2x' => $thumb_sm_hpt1_2x[0],
'thumb_xs_hpt1_2x' => $thumb_xs_hpt1_2x[0],
'thumb_xl_hpt1' => $thumb_xl_hpt1[0],
'thumb_large_hpt1' => $thumb_lg_hpt1[0],
'thumb_medium_hpt1' => $thumb_md_hpt1[0],
'thumb_small_hpt1' => $thumb_sm_hpt1[0],
'thumb_xs_hpt1' => $thumb_xs_hpt1[0],
'thumb_alt' => $alt_text
);
$html = '<picture>';
$html .= '<!--[if IE 9]><video style="display: none;"><![endif]-->';
$html .= '<source srcset="' . $thumb_data['thumb_xl_hpt1'] . ', ' . $thumb_data['thumb_xl_hpt1_2x'] . ' 2x" media="(min-width: 1200px)">';
$html .= '<source srcset="' . $thumb_data['thumb_large_hpt1'] . ', ' . $thumb_data['thumb_large_hpt1_2x'] . ' 2x" media="(min-width: 992px)">';
$html .= '<source srcset="' . $thumb_data['thumb_medium_hpt1'] . ', ' . $thumb_data['thumb_medium_hpt1_2x'] . ' 2x" media="(min-width: 768px)">';
$html .= '<source srcset="' . $thumb_data['thumb_small_hpt1'] . ', ' . $thumb_data['thumb_small_hpt1_2x'] . ' 2x" media="(min-width: 576px)">';
$html .= '<!--[if IE 9]></video><![endif]-->';
$html .= '<img srcset="' . $thumb_data['thumb_xs_hpt1'] . ', ' . $thumb_data['thumb_xs_hpt1_2x'] . ' 2x" alt="' . $thumb_data['thumb_alt'] . '">';
$html .= '</picture>';
return $html;
}
add_filter( 'image_send_to_editor', 'mystic_responsive_insert_image', 10, 9 );
I then created a test post and inserted the image into it to see if my code works. It does. But then after I deleted the image and inserted another one, inside the chrome inspector I noticed that the additional html code from the deleted image is still present on the page. Everything except the img tag that was placed inside the picture tag is still there. Deleting the image from the editor removed only the img tag.
I'm making this for someone who is not familiar with html and I'm certain that they will not be able to delete the leftover code from the text editor if they ever edit the images in their posts so I need to figure out why is this happening and how can I fix it?
This is because while removing image, visual editor only removes image in img tag and rest of the HTML is still there. On updating, it updates the HTML in database.
Also, It appends previous HTML with new HTML.
You just have to filter data before it is saved. Have to remove 'picture' tag in which there is no image. You can use 'wp_insert_post_data' hook for this.
I'm new to php and wordpress.
When I edit an icon box from the theme in the admin panel, i have a few fields, like "title" and "content". The title is inside <h4> </h4> and content is inside <p>
</p>
I need to add another <p style='iconbox_price'></p> after the content, so i can edit it in the admin panel.
This is the code for the iconbox. How can i add this to it, so it would work out.
<?php
function easyweb_webnus_iconbox( $attributes, $content = null ) {
extract(shortcode_atts(array(
"type"=>'',
'icon_title'=>'',
'icon_link_url'=>'',
'icon_link_text'=>'',
"icon_name"=>'',
"iconbox_content"=>'',
"icon_size"=>'',
"icon_color"=>'',
"title_color"=>'',
"content_color"=>'',
"link_color"=>'',
"icon_image"=>'',
"featured"=>'',
"border_left"=>'',
"border_right"=>'',
), $attributes));
ob_start();
$type = ( $type == 0 ) ? '' : $type ;
$iconbox_style = $type17_start_wrap = $type17_end_wrap = '';
if ( $type==17 ) {
$iconbox_style = ( !empty($icon_color) ) ? ' style="color: ' . esc_attr($icon_color) . '"' : '' ;
$type17_start_wrap = '<div class="icon-wrap" style="background-color:' . esc_attr($icon_color) . '">';
$type17_end_wrap = '</div>';
}
$iconbox22_class = '';
if ( $type == 22 ) {
$iconbox22_class .= $featured ? ' ' . $featured : '';
$iconbox22_class .= $border_left ? ' ' . $border_left : '';
$iconbox22_class .= $border_right ? ' ' . $border_right : '';
}
echo '<article class="icon-box' . $type . $iconbox22_class . '" ' . $iconbox_style . '>';
if(!empty($icon_name) && $icon_name != 'none') :
if(!empty($icon_link_url))
echo '' . $type17_start_wrap . '' . do_shortcode( "[icon name='$icon_name' size='$icon_size' color='$icon_color']" ).'' . $type17_end_wrap . '';
else
echo $type17_start_wrap . do_shortcode( "[icon name='$icon_name' size='$icon_size' color='$icon_color']" ) . $type17_end_wrap;
elseif(!empty($icon_image)) :
if(is_numeric($icon_image)){
$icon_image = wp_get_attachment_url( $icon_image );
}
if(!empty($icon_link_url))
echo "<a href='$icon_link_url'>" . '<img src="'.$icon_image.'" alt="" />' . '</a>' ;
else
echo '<img src="'.$icon_image.'" alt="" />';
endif;
$title_style = !empty($title_color)?' style="color:'.$title_color.'"':'';
echo '<h4'.$title_style.'>' . $icon_title . '</h4>';
$content_style = !empty($content_color)?' style="color:'.$content_color.'"':'';
echo '<p'.$content_style.'>'.$iconbox_content .'</p>' ;
$link_style = !empty($link_color)?' style="color:'.$link_color.'"':'';
echo (!empty($icon_link_url) && (!empty($icon_link_text)) )?"<a".$link_style." class=\"magicmore\" href=\"{$icon_link_url}\">{$icon_link_text}</a>":'';
echo '</article>';
$out = ob_get_contents();
ob_end_clean();
$out = str_replace('<p></p>','',$out);
return $out;
}
add_shortcode('iconbox', 'easyweb_webnus_iconbox');
In html this is the code, that is generated:
<article class="icon-box14">
<a href="/razrabotka-saitov/">
<i class="sl-screen-desktop" style=" font-size:42px;"></i>
</a>
<h4 style="height: 22px;">Title</h4>
<p style="height: 116px;">Content<br></p>
<a class="magicmore" href="#">More</a>
</article>
You see the line there:
echo '<p'.$content_style.'>'.$iconbox_content .'</p>' ;
You can add your custom paragraph to that line:
echo '<p'.$content_style.'>'.$iconbox_content .'</p>
<p style='iconbox_price'></p>' ;
I found the solution in my case. Maybe it will help somebody else. I had to edit two files. In my case this is where the first file was located.
wp-content/plugins/'theme'-shortcodes/shortcodes/iconbox.php
I tried to look for where comes the variable $iconbox_content and found it in getting extracted in the code above from an array at this point:
extract(shortcode_atts(array(
"type"=>'',
'icon_title'=>'',
'icon_link_url'=>'',
'icon_link_text'=>'',
"icon_name"=>'',
"iconbox_content"=>'',
"icon_size"=>'',
"icon_color"=>'',
"title_color"=>'',
"content_color"=>'',
"link_color"=>'',
"icon_image"=>'',
"featured"=>'',
"border_left"=>'',
"border_right"=>'',
), $attributes));
So i searched through all the wordpress directory files, because i did not even have an idea where can i find it.
And found it in the themes => 'my theme' => 'my theme' => visualcomposer => shortcodes directory as 03-iconbox.php
I had there different arrays such as this:
array(
"type"=>'textarea',
"heading"=>esc_html__('Content', 'ew'),
"param_name"=> "iconbox_content",
"value"=>"",
"description" => esc_html__( "IconBox Content Goes Here", 'ew')
),
So i guess, the other half of what i did is very logical already, but here it is anyway:
I added an array in this file:
array(
"type"=>'textarea',
"heading"=>esc_html__('Price', 'ew'),
"param_name"=> "iconbox_price",
"value"=>"",
"description" => esc_html__( "Price goes here", 'ew')
),
And in the first file:
To extract "iconbox_price" =>'',
And lower: echo '<p class="iconbox_price">'.$iconbox_price .'</p>' ;
Wish that this helps someone!
I'm not a a big pro-Pro, but I do know my way around in basic scripting/adjusting/editing and stuff when it comes to CMS. Right now, I'm using WordPress for my website. I modified a theme and all is running quite well (it's in construction mode).
However, there's one thing I've been trying to accomplish, but I can't get it to work.
WordPress has this feature called Featured Image. It's an image/thumbnail you can include to an article. What I'm trying to do here, is to turn that Featured Image into a imagehover. So when people move their mouse over the (black and white) image, it turns into another (colored) image.
One of the things I've been able to figure out, is using a WordPress pluging called Multiple Post Thumbnails. It lets you add 2 Featured Images (thumbnails) to a single article. In this case: a black and white image and a colored image.
Now here's the thing; there in fact can be found some sort of a tutorial on how to activate this modification, but I can't get it to work. URL: http://www.scratchinginfo.net/hover-two-featured-images-wordpress-via-multiple-post-thumbnails-plugin/
So my two questions:
Is there a better (easier) way to accomplish this imagehover?
As for the tutorial:
I used copy/paste on all code and added it to my own files/theme. All it gave me was a blanc page. I had to remove and adjust some code from the functions.php code (for instance the name of the theme) to get it to work at all (meaning: to be able to show my page at all):
Tutorial:
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Colored Image',
'id' => 'colored-image',
'post_type' => 'post'
)
);
}
Only shows up anything like this:
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Colored Image',
'id' => 'colored-image',
'post_type' => 'post'
)
);
}
Like I said, I can't get it to work. Adjusting this piece of code leaves me off where I started. Black and white images (Featured Image 1) only.
I'm using this Cosmox theme: http://cosmox.ozythemes.com/. I created a page with a couple of images/thumbnails (which are the Featured Images) of partners (faces) under each other. When you scroll over those images, a textbox with information is revealed. It's basically the same as the WHATS NEW section.
Hopefully there's a simple solution to this one ;)
Thanks so much!
#dingo_d:
foreach( $myposts as $post ) : the_post(); $more = 0;
echo '<li>';
echo ' <div class="item-wrapper">';
echo ' <div>';
if ( has_post_thumbnail() ):
$upload_dir = wp_upload_dir();
$custom = get_post_custom(); $custom = get_post_meta($custom["_thumbnail_id"][0]);
$custom = unserialize($custom['_wp_attachment_metadata'][0]); $upload_folder = dirname($custom['file']);
if(isset($custom['sizes']) && !empty($custom['sizes'])) {
echo '<img src="'. $upload_dir['baseurl'] . '/' . $upload_folder . '/' . $custom['sizes']['portfolio-featured-thumb-460']['file'] . '" width="100%"/>';
}else{
echo '<img src="'. $upload_dir['baseurl'] . '/' . $custom["file"] . '" width="100%"/>';
}
else:
//no image image
echo '<img src="' . OZY_BASE_URL . 'images/no-image310x140.png" width="100%"/>';
endif;
echo ' <div class="hover"></div>';
echo ' </div>';
echo ' <span class="cfnt" align="center">';
the_title();
echo ' </span>';
echo ' </div>';
if($xml->description=='1') echo '<div class="desc"><span class="cfnt">' . get_the_title() . '</span><p>' . strip_tags(get_the_content('','')) . '</p></div>';
echo "</li>";
endforeach;
EDIT 2:
echo '<img src="'. $upload_dir['baseurl'] . '/' . $upload_folder . '/' . $custom['sizes']['portfolio-featured-thumb-460']['file'] . '" width="100%" class="nohover" /><img alt="imagehover" src="URL TO HOVER IMAGE" class="hover" />';
From the code above your output should be something like this (in html)
<li>
<div class="item-wrapper">
<div>
<img src=""/>
<div class="hover"></div>
</div>
<span class="cfnt" align="center"></span>
</div>
<div class="desc"><span class="cfnt"></span><p></p></div>
</li>
Under the image there is an empty div with the class hover that you can use in conjuncture with this effect, to make your image first be black, and then be revealed on hover.
I have a very weird problem and I would really appreciate your help with it.
I am using wp_insert_post when a user submits a post. It works fine when I submit the form (i.e. the admin of the wordpress site), but when I try the same thing with a different user (i.e. different email, not the admin of the wordpress site), it only shows part of the content I used in the post_content field.
my code:
$my_post = array(
'post_title' => 'My bet',
'post_content' => '<form action="" method="post" id=form_id>' . 'bet ID: ' . '<input readonly id=betid type=text value=' . $bet_id . '>' . '<input id=url name=urlpath type=hidden value=>' . '</form>' ."\r\n match: " . '<span id=match>' . $_POST[event] . '</span>' . "\r\n" . $current_user->user_login . "'s Pick: " . $_POST[bet] . '</span>' . '<span id=friends>' . '</span>' ."\r\n Amount: " . '<span id=amount>' . $_POST[amount] . '</span>' . "<?php include('wp-content/themes/twentyfourteen/test.php') ?>"
'post_status' => 'publish');
When it is executed for the wordpress admin user (user ID=1) it works fine. when it is executed for any other user (user ID!=1) it is not showing the input fields of the form, and more important, not including the test.php I have included.
To get a list of a content type's cck fields, I was hoping to use:
drupal_get_schema('content_type_mycontenttype');
but that leaves out fields with multiple values. Is there a simple call to use to get such a list?
Take a look at the content_fields function, and if doesn't that have the information you need, there is _content_type_info.
Additionally, once you have the field information, you can extract the table storage and column names using content_database_info.
For Drupal 7, check out the field_info_instances function to retrieve a list of fields for a particular node content type.
Here is an example usage that will retrieve all the fields for a node content type.
$my_content_type_fields = field_info_instances("node", "my_node_content_type");
I've used something like this before to do a quick list of CCK Field information for a content type:
$mytype = 'article';
$contentinfo = _content_type_info();
$output .= "<ul>";
foreach($contentinfo['fields'] as $field) {
if ($field['type_name'] == $mytype) {
$output .= '<li id="field-' . $field['field_name'] . '">' . $field['widget']['label'] . '<br>';
if ($field['widget']['description']) {
$output .= $field['widget']['description'] . '<br>';
}
$output .= '<ul>
<li>Content Types: ' . $field['type_name'] . '</li>
<li>Type: ' . $field['type'] . '</li>
<li>' . $field['field_name'] . '</li>
</ul>';
}
}
$output .= '</ul>';