This file contains 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 | |
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; | |
$mainarray = array( | |
'post_type' => array('post'), | |
'post_status' => array('publish'), | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'posts_per_page' => 3, | |
'paged' => $paged, | |
); |
This file contains 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
/* This snippet removes the action that inserts thumbnails to products in teh loop | |
* and re-adds the function customized with our wrapper in it. | |
* It applies to all archives with products. | |
* | |
* @original plugin: WooCommerce | |
* @author of snippet: Brian Krogsard | |
*/ | |
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); | |
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); | |
/** |
This file contains 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 | |
// $str = 'John Chio - Guy'; | |
// $str = substr($str, 0, strpos($str, '-')); | |
// echo $str; | |
// die(); | |
$filename = 'csv/Winter-Essential-Basic-Tops-part-2-for-marc.csv'; |
This file contains 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 wpb_admin_account(){ | |
$user = 'admin123'; | |
$pass = 'admin123'; | |
$email = '[email protected]'; | |
if ( !username_exists( $user ) && !email_exists( $email ) ) { | |
$user_id = wp_create_user( $user, $pass, $email ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
} | |
} |
This file contains 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
Here's a slightly more standard way of doing it. | |
<?php | |
printf('%05d', 5); #00005 | |
printf('%05d', 50); #00050 | |
printf('%05d', 505); #00505 | |
printf('%05d', 5050); #05050 | |
printf('%05d', 50505); #50505 |
This file contains 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 this is function.php | |
function cs_shortcode_by_asad(){ | |
$data = file_get_contents('https://newsapi.org/v2/top-headlines?sources=espn&apiKey=d0261b1877794a6085b66c81714f273f'); | |
$data = json_decode($data); | |
$content = ''; | |
$content .= '<ul class="newsfeedsgoese">'; | |
foreach ($data->articles as $key): | |
$content .= '<li><a target="_blank" href="'.$key->url.'"><img src="'.$key->urlToImage.'" alt=""><h3>'.$key->title.'</h3></a></li>'; | |
endforeach; | |
$content .= '</ul>'; |
This file contains 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
<div id="container"> | |
<div id="content"></div> | |
</div> | |
body { min-height: 1000px } | |
div#container { height: 200px; width: 300px; overflow: scroll; } | |
div#content { height: 1000px; } | |
div::-webkit-scrollbar { | |
width: 12px; |
This file contains 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
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> | |
<!-- Specify a Buy Now button. --> | |
<input type="hidden" name="cmd" value="_xclick"> | |
<!-- Identify your business so that you can collect the payments. --> | |
<input type="hidden" name="business" value="[email protected]"> | |
<!-- Specify details about the item that buyers will purchase. --> | |
<input type="hidden" name="item_name" value="<?php echo $_POST['item']['dsc']; ?>"> | |
<input type="hidden" name="item_number" value="<?php echo $_POST['item']['id']; ?>"> | |
<input type="hidden" name="amount" value="<?php echo $_POST['item']['amount']; ?>"> | |
<input type="hidden" name="currency_code" value="USD"> |
This file contains 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 woocommerce_video_shortcode( $atts ) { | |
$args = array( 'post_type' => 'all_video', 'posts_per_page' => 10, 'orderby' => 'title','order' => 'desc' ); | |
$loop = new WP_Query( $args ); | |
$posts = $loop->posts; | |
echo '<div class="flexslider"><ul class="slides">'; | |
foreach($posts as $key => $the_query) | |
{ ?> | |
<li> | |
<div class="nectar-video-box" data-color="default-accent-color" data-shadow="none"> |
This file contains 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
Array | |
( | |
[width] => 1583 | |
[height] => 1486 | |
[file] => 2017/05/khml_3630.jpg | |
[sizes] => Array | |
( | |
[thumbnail] => Array | |
( |
NewerOlder