This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.dev4press.com/blog/tutorials/2017/url-rewriting-custom-post-types-date-archive/ | |
Date archives are very useful if you want to list your posts only for the specified year, month or day. But, they only work with posts, and not with the custom post types. | |
Year archive: http://www.example.com/2011/ | |
Month archive: http://www.example.com/2010/10/ | |
Day archive: http://www.example.com/2012/02/22/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . ! -name 'file.txt' -type f -exec rm -f {} + | |
will remove all regular files (recursively, including hidden ones) except file.txt. To remove directories, change -type f to -type d and add -r option to rm. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'pre_get_posts', 'custom_post_type_archive' ); | |
function custom_post_type_archive( $query ) { | |
if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'gallery' ) ) { | |
$query->set( 'posts_per_page', '12' ); | |
$query->set( 'orderby', 'menu_order' ); | |
$query->set( 'order', 'ASC' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: HTML Test | |
*/ | |
get_header(); | |
?> | |
<h1>HTML tags with lorem ipsum...</h1> | |
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file in server | |
<?php | |
$pdf = new FPDF(); | |
$pdf->AddPage(); | |
$pdf->SetFont('Arial','B',16); | |
$pdf->Cell(40,10,'Hello World!'); | |
$pdf->Output("testsuccess.pdf",'F'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hide Yoast Meta boxes in unnecessary post type | |
function remove_yoast_metabox_reservations(){ | |
remove_meta_box('wpseo_meta', 'your_post_type', 'normal'); | |
} | |
add_action( 'add_meta_boxes', 'remove_yoast_metabox_reservations',100 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Custom User Registration Notification | |
Description: Customized User registration notification | |
Version: 1.0 | |
Author: Sarathlal N | |
Author URI: http://sarathlal.com | |
*/ | |
// Redefine user notification function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wp_mail_from', 'notification_from_email'); | |
add_filter('wp_mail_from_name', 'notification_from_name'); | |
function notification_from_email($email_address){ | |
$blog_url = get_site_url(); | |
$output1 = str_replace(array('http://','https://', 'www'), '', $blog_url); | |
$output2 = strstr($output1, '/', true); | |
if($email_address === "wordpress@" . $output2) | |
return 'noreply@'. $output2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Update malamutename | |
function malamutename_acf_load_field( $field ) { | |
$malamutename = htmlspecialchars($_GET["malamutename"]); //get URL query string - malamutename | |
$field['default_value'] = $malamutename; | |
return $field; | |
} | |
add_filter('acf/load_field/name=malamutename', 'malamutemame_acf_load_field'); //acf/load_field/name=yourfieldname | |
//Update sira | |
function sire_acf_load_field( $field ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ghjut35_script() { | |
if(is_singular('product')){ | |
?> | |
<script type="text/javascript"> | |
function QueryStringToJSON() { | |
var pairs = location.search.slice(1).split('&'); | |
var result = {}; | |
pairs.forEach(function(pair) { | |
pair = pair.split('='); |