Monthly Archives: November 2015

Dreamweaver – Remove Line Space

  1. Go to Edit->Find and Replace (ctrl+F or cmd+F).
  2. In the Find box enter “[\r\n]{2,}” (without the quotes).
  3. In the Replace box enter “\n” (again without the quotes).
  4. Make sure you check the box for “Use regular expression”.
  5. Press the Find All button.find and replace
Advertisements

css for Print web page

header.php
<link rel=”stylesheet” href=”<?php echo get_template_directory_uri(); ?>/css/print.css”
type=”text/css” media=”screen, print” />

print.css

@media print {

/* Avoid to display link on anchor tag */
a:link:after, a:visited:after {
content: “” !important;
}
}

Simple mail on form submit


<?php

if(isset($_POST['Submit'])){
$to = 'ravi.loyalweb@gmail.com';
$subject = $_POST['subject'];

$name_field = $_POST['Name'];
$address_field = $_POST['Address'];
$country_field = $_POST['Country'];
$postcode_field = $_POST['Postcode'];
$telephone_field = $_POST['telephone'];
$email_field = $_POST['email'];
$size_field = $_POST['size'];
$metal_field = $_POST['Metal'];

$headers = "From: $name_field <$email_field>\r\n";
$headers .= "Reply-To: $email_field\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$body ="Name : $name_field <br/>
Address : $address_field;<br/>
Country: $country_field;<br/>
Postcode: $postcode_field;<br/>
Telephone: $telephone_field <br/>
Email: $email_field <br/>
size: $size_field <br/>
Metal: $metal_field <br/>";

mail($to, $subject, $body, $headers);
}
?>
<script language="javascript">
window.location.href = "http://www.taylortrumpets.com/thank_you.html"
</script>

Register Sidebars


/*
* Legal Main Sidebar
*/

function legal_widgets_init() {

register_sidebar(array(
'name' => __('Main Sidebar', 'legal'),
'id' => 'sidebar-1',
'description' => __('Main sidebar that appears on the right.', 'legal'),
'before_widget' => '<aside id="%1$s" class="sidebar-widget widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));

register_sidebar(array(
'name' => __('Footer Area One', 'legal'),
'id' => 'footer-1',
'description' => __('Footer Area One that appears on footer.', 'legal'),
'before_widget' => '<aside id="%1$s" class="footer-widget widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));

register_sidebar(array(
'name' => __('Footer Area Two', 'legal'),
'id' => 'footer-2',
'description' => __('Footer Area Two that appears on footer.', 'legal'),
'before_widget' => '<aside id="%1$s" class="footer-widget widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));

register_sidebar(array(
'name' => __('Footer Area Three', 'legal'),
'id' => 'footer-3',
'description' => __('Footer Area Three that appears on footer.', 'legal'),
'before_widget' => '<aside id="%1$s" class="footer-widget widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));

register_sidebar(array(
'name' => __('Footer Area Four', 'legal'),
'id' => 'footer-4',
'description' => __('Footer Area Four that appears on footer.', 'legal'),
'before_widget' => '<aside id="%1$s" class="footer-widget widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}

add_action('widgets_init', 'legal_widgets_init');



Display:


<div class="col-md-3 col-sm-6">
<?php if (is_active_sidebar('footer-1')) { ?>
<div class="footer-widget">
<?php dynamic_sidebar('footer-1'); ?>
</div>
<?php } ?>
</div>

excerpt – read more link and number of character to display


/* Set size of characher in excerpt */
function legal_excerpt_length($length) {
// return 35;
$legal_options = get_option( 'legal_theme_options' );
global $post;
if ($post->post_type == 'post')
if(!empty($legal_options['excerptlength'])) {
return __($legal_options['excerptlength']);
} else {
return __('50','legal');
}
}
add_filter('excerpt_length', 'legal_excerpt_length');


/* readmore button if more content */
function legalt_excerpt_more() {
global $post;
if ($post->post_type == 'post') {
return '...<div class="button-div"><a href="' . get_permalink() . '" class="button-read">' . __('Read more', 'legal') . '</a></div>';
}
}
add_filter("excerpt_more", "legalt_excerpt_more");

create shortcode and place anything inside


/* shortcode */
function display_my_shortcode($atts, $content, $tag){

//if called from the 'my_primary_shortcode'

shortcode
if($tag == 'my_primary_shortcode'){
return '<div class="myclasss">
--------
</div>';
}
}
add_shortcode

('my_primary_shortcode','display_my_shortcode');

Display

[my_primary_shortcode]

%d bloggers like this: