View Center hero image
.hero{
height:200px;
overflow:hidden;
display:flex;
align-items:center;
justify-content:center
}
.hero div{
min-width:100%; display:flex;
View Scroll to element on load
if(location.hash){
var e = document.getElementById(location.hash.substr(1));
e.scrollIntoView();
}
View Truncate text by word
function texto($text, $limit=8) {
if (str_word_count($text, 0) > $limit) {
$words = str_word_count($text, 2);
$pos = array_keys($words);
$text = substr($text, 0, $pos[$limit]) . '...';
}
return $text;
}
View WP add custom profile field
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
add_action( 'user_new_form', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
<table class="form-table">
View click loop
var inputs = document.querySelectorAll('a._42ft._4jy0._4jy3._517h');
for(var i=1; i<inputs.length;i++) {
var str =inputs[i].text, str2 ='Invite';
if(str.indexOf(str2) >= 0){inputs[i].click(); console.log('|');} }
View .htaccess
<FilesMatch "^(wp-config|wp-settings|wp-trackback|wp-comments-post|xmlrpc)\.php$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
View embed
function initFbEmbedPosts(){
jQuery('.embed-fb-comments').each(function(i,e){
var comment = jQuery(e);
var postId = comment.attr('data-post-id');
//you will need the div with attribute data-post-id
//You can also make this get the ID from the fb embed post element
jQuery.getJSON('https://graph.facebook.com/'+ postId +'/comments', null, function(data){
for (obj in data.data) {
View wordpress
$arr = Array(
'post_type'=>'post',
'posts_per_page'=>9,
'cat'=>107
);
$q= new WP_Query( $arr );
while ( $q->have_posts() ) : $q->the_post();
$meta = get_post_meta( get_the_ID() );
$tel = $meta['wpcf-telefono'][0];
View WPConfig
define('td', get_bloginfo('template_directory').'/' );
define('hd', esc_url(home_url( '/' )));
//WPconfig
$path = '/path';
define( 'WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . $path );
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . $path );
define( 'AUTOSAVE_INTERVAL', 3600 );
define( 'WP_POST_REVISIONS', 3 );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
View htaccess
ErrorDocument 410 "Frankly, my dear, I don't give a damn.
#410 Gone with the wind.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD|POST|PUT)$
RewriteCond %{HTTP_REFERER} !^http://(.*)?yourserver\.com [NC]
RewriteCond %{REQUEST_URI} ^/(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/(.*)?wp-admin(.*)$
RewriteRule ^(.*)$ - [R=410,L]
</IfModule>