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
<?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
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
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
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
<?php | |
/* | |
Template Name: archive | |
*/ | |
get_header(); | |
wp_enqueue_script('magnific'); | |
add_action('wp_footer', 'san_scripts', 21); | |
function san_scripts() { |
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
1. Install SMTP Plugins | |
https://wordpress.org/plugins/search/SMTP/ | |
2. Configure Plugins | |
* Outgoing Mail (SMTP) Server: smtp.gmail.com | |
* Use Authentication: Yes | |
* Use Secure Connection: Yes (TLS or SSL) | |
* Username: your Gmail account (e.g. [email protected]) |
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
$customer_id = get_current_user_id(); | |
$customer_orders = get_posts( array( | |
'numberposts' => -1, | |
'meta_key' => '_customer_user', | |
'meta_value' => $customer_id, | |
'post_type' => wc_get_order_types(), | |
'post_status' => array_keys( wc_get_order_statuses() ), | |
//'post_status' => array('wc-completed'), | |
) ); |
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
Why WordPress not using session in PHP. Reason and the better alternatives. | |
https://pressjitsu.com/blog/wordpress-sessions-performance/ | |
https://techgirlkb.guru/2017/08/wordpress-doesnt-use-php-sessions-neither/ |
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
/* | |
* For latest WooCommerce Rest API | |
* Add a referanse field to the Order API response. | |
*/ | |
function prefix_wc_rest_prepare_order_object( $response, $object, $request ) { | |
// Get the value | |
$referanse_meta_field = ( $value = get_post_meta($object->get_id(), '_billing_referanse', true) ) ? $value : ''; | |
$response->data['referanse'] = $referanse_meta_field; |