Edit file .conf nginx for domain
location / {
try_files $uri $uri/ /index.php?$args;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
Home / website
define('FORCE_SSL_ADMIN', true);
and/ordefine('FORCE_SSL_LOGIN', true);
in wp-config.php. Since HAProxy offloads the SSL connection, the web
server running the WordPress site has no way to know the connection was
SSL-based initially. Edit wp-config.php and add the following lines: define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
We’re telling WordPress that if an X-Forwarded-Proto header is present with the value https,
the connection was initially based on SSL. Obviously, the
X-Forwarded-Proto header has to be injected into the HTTP header of the
request by HAProxy in the first place:frontend ft_web_ssl mode http bind 0.0.0.0:443 ssl crt /etc/haproxy/certs.d reqadd X-Forwarded-Proto:\ https ... ...Make sure to use option http-server-close as well or the reqadd setting might not work as expected.
footer.php file and right before the body element closes add the following:<button class="button-top">↑</button>
.button-top {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 100;
width: 60px;
height: 60px;
border: 0;
border-radius: 2px;
box-shadow: none;
background: #145474;
color: #fff;
font-size: 26px;
line-height: 20px;
text-align: center;
cursor: pointer;
}
.button-top {
...previous code
pointer-events: none;
opacity: 0;
transition: opacity .18s ease;
}
.button-top-visible {
opacity: 1;
pointer-events: auto;
}
scripts file (make sure jQuery is loaded!):jQuery(function ($) {
var $buttonTop = $('.button-top');
$buttonTop.on('click', function () {
$('html, body').animate({
scrollTop: 0,
}, 400);
});
});
window object and check if we’re scrolled enough from the top; if we are, we’ll add that .button-top-visible CSS class and show it. If we aren’t we’ll remove it (and consequently hide the button).scroll event as the name implies, but how are we going to figure out how much we’ve scrolled so far? Let’s see what jQuery offers.
.scrollTop(): Get the current vertical position of the scroll bar for the first element in the set of matched elements.
Well, that sounds exactly what we need. Let’s amend our code and do just that.jQuery(function ($) {
var $window = $(window);
var $buttonTop = $('.button-top');
$buttonTop.on('click', function () {
$('html, body').animate({
scrollTop: 0,
}, 400);
});
$window.on('scroll', function () {
if ($window.scrollTop() > 100) { // 100 is our threshold in pixels
$buttonTop.addClass('button-top-visible');
} else {
$buttonTop.removeClass('button-top-visible');
}
});
});
jQuery(function ($) {
var $window = $(window);
var $buttonTop = $('.button-top');
var scrollTimer;
$buttonTop.on('click', function () {
$('html, body').animate({
scrollTop: 0,
}, 400);
});
$window.on('scroll', function () {
clearTimeout(scrollTimer);
scrollTimer = setTimeout(function() {
if ($window.scrollTop() > 100) {
$buttonTop.addClass('button-top-visible');
} else {
$buttonTop.removeClass('button-top-visible');
}
}, 250);
});
})
- Add to funtions.php
function sgr_show_current_cat_on_single($output) {
global $post;
if( is_single() ) {
$categories = wp_get_post_categories($post->ID);
foreach( $categories as $catid ) {
$cat = get_category($catid);
// Find cat-item-ID in the string
if(preg_match('#cat-item-' . $cat->cat_ID . '#', $output)) {
$output = str_replace('cat-item-'.$cat->cat_ID, 'cat-item-'.$cat->cat_ID . ' current-cat', $output);
}
}
}
return $output;
}
add_filter('wp_list_categories', 'sgr_show_current_cat_on_single');
- Add style.php
.widget ul li.current-cat {
background-color: #26609b;
font-weight: bold;
}
UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="http://www.oldsiteurl.com', 'src="http://newsiteurl.com');
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsiteurl.com', 'http://newsiteurl.com') WHERE post_type = 'attachment';
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');or via command line:
username@[~/Desktop]: mysql -u root -p databasename Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 892 Server version: 5.5.13 MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; Query OK, 0 rows affected (0.00 sec) Rows matched: 2 Changed: 0 Warnings: 0 mysql> UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); Query OK, 0 rows affected (0.02 sec) Rows matched: 964 Changed: 0 Warnings: 0 mysql> UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); Query OK, 0 rows affected (0.05 sec) Rows matched: 964 Changed: 0 Warnings: 0 mysql> UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');g Query OK, 0 rows affected (0.01 sec) Rows matched: 686 Changed: 0 Warnings: 0
Finally update your WordPress config file to reflect the new database, wp-config.php” which should be in your web document root – change, databasename, username, password and host values:
define('DB_NAME', 'databasename');
/** MySQL database username */
define('DB_USER', 'username');
/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Now everything should link up perfectly.
function new_trim_excerpt($text) {
global $post;
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace('\]\]\>', ']]>', $text);
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
$text = strip_tags($text, '<a>');
$excerpt_length = 80;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words)> $excerpt_length) {
array_pop($words);
array_push($words, '</a><a>ID) . '">Read the Rest...</a>');
$text = implode(' ', $words);
}
}
return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'new_trim_excerpt');
|
1
2
|
|
|
1
2
3
4
5
6
7
|
|
|
1
2
|
|
function ilc_mce_buttons($buttons){ array_push($buttons, "backcolor", "anchor", "hr", "sub", "sup", "fontselect", "fontsizeselect", "styleselect", "cleanup"); return $buttons;}add_filter("mce_buttons", "ilc_mce_buttons"); |
mce_buttons thành mce_buttons_2 hoặc mce_buttons_3 hoặc mce_buttons_4.if(simpleCart.items().length == 0)
{
//No items in the cart
}
If you want to check a particular item already present in the cart, using jQuery.simpleCart.bind('beforeAdd', function (item) {
if (simpleCart.has(item))
{
alert("Already in the Cart");
return false;
}
});
<script type="text/javascript"> $(document).ready(function() { $('body').append('<div id="backtotop">^Top</div>'); $(window).scroll(function() { if($(window).scrollTop() >200) { $('#backtotop').fadeIn(); } else { $('#backtotop').fadeOut(); } }); $('#backtotop').click(function() { $('html, body').animate({scrollTop:0},500); }); });</script> #backtotop {
background: url("images/scroll-top.png") no-repeat scroll left top #666666;
width: 29px;
height: 29px;
position: fixed;
bottom: 50px;
right: 50px;
cursor: pointer;
border-radius: 30px;
} custom structure blank |
custom structure /%year%/%monthnum%/%day%/%postname%/ |
custom structure /%year%/%monthnum%/%postname%/ |
custom structure /archives/%post_id% |
custom structure /%postname%/ |
custom structure /%year%/%monthnum%/%day%/%postname%.html |
custom structure /%year%/%monthnum%/%postname%.html |
custom structure /archives/%post_id%.html |
custom structure /%postname%.html |
add_action('init', 'change_page_permalink', -1);function change_page_permalink() { global $wp_rewrite; if ( strstr($wp_rewrite->get_page_permastruct(), '.html') != '.html' ) $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html'; $wp_rewrite->flush_rules();}function checkform() { if(document.frmMr.name.value == "" ||document.frmMr.email.value == "") { alert("please enter info"); return false; } else { document.frmMr.submit(); } } <html> <form name=frmMr action="page1.jsp" > Enter Start date: <input type="text" size="15" name="name" id="name">
<input type="text" size="15" name="email" id="email">
<input type="submit" name="continue" value="submit" onClick="checkform();">
</form>
</html>
<?php
$id = ID#;
$p = get_page($id);
echo apply_filters('the_content', $p->post_content);
?>
$id = 14;
<?php
$id = 5;
$p = get_page($id);
echo apply_filters('the_content', $p->post_content);
?>
<?php
$id = 6;
$p = get_page($id);
echo apply_filters('the_content', $p->post_content);
?>