$my_post = array(
‘post_title’ => wp_strip_all_tags( $_POST[‘post_title’] ),
‘post_content’ => $_POST[‘post_content’],
‘post_status’ => ‘publish’,
‘post_author’ => 1,
‘post_category’ => array( 8,39 )
);
// Insert the post into the database
wp_insert_post( $my[...]
$my_post = array(
‘post_title’ => wp_strip_all_tags( $_POST[‘post_title’] ),
‘post_content’ => $_POST[‘post_content’],
‘post_status’ => ‘publish’,
‘post_author’ => 1,
‘post_category’ => array( 8,39 )
);
// Insert the post into the database
wp_insert_post( $my_post );
1
setTimeout(function(){
console.log("Hello World");
}, 2000);
setTimeout(function(){
console.log("Hello World");
}, 2000);
2
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
4
$( document ).ready(function() {
console.log( "ready!" );
});
$( document ).ready(function() {
console.log( "ready!" );
});
4
$categories = get_categories( array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘exclude’ => ‘1’, ‘hide_empty’ => 0,) );
$categories = get_categories( array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘exclude’ => ‘1’, ‘hide_empty’ => 0,) );
12
$.ajax({
url:"https://url.here.com",
method:"GET",
data:{id:id},
success:function(data){
$('#r'+id).html(data);
}
[...]
$.ajax({
url:"https://url.here.com",
method:"GET",
data:{id:id},
success:function(data){
$('#r'+id).html(data);
}
});
6
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
2
@keyframes rainbow {
0% {
background: rgb(243, 162, 162, 0.5);
}
/* Adding a step in the middle */
10% {
background: rgb(229, 202, 150, 0.5);
}
20% {
background: rgb(236, 211, 98, 0.5);
}
30% {
background: rgb(120, 241, 151, 0.5);[...]
@keyframes rainbow {
0% {
background: rgb(243, 162, 162, 0.5);
}
/* Adding a step in the middle */
10% {
background: rgb(229, 202, 150, 0.5);
}
20% {
background: rgb(236, 211, 98, 0.5);
}
30% {
background: rgb(120, 241, 151, 0.5);
}
40% {
background: rgb(31, 218, 115, 0.5);
}
50% {
background: rgb(133, 240, 225, 0.5);
}
60% {
background: rgb(98, 181, 236, 0.5);
}
70% {
background: rgb(165, 134, 238, 0.5);
}
80% {
background: rgb(238, 134, 238, 0.5);
}
90% {
background: rgb(230, 109, 193, 0.5);
}
100% {
background: rgb(238, 134, 151, 0.5);
}
}
4
.click( function(){});
.click( function(){});
3
animation: pulse 1s infinite
animation: pulse 1s infinite
5
event.preventDefault(); // stop default form action
$.ajax({
url:"inc.php",
method:"POST",
data:$('#insert_form').serialize(),
beforeSend:function(){
$('#insert').val("Inserting");
},
success:function(data){
$('#ins[...]
event.preventDefault(); // stop default form action
$.ajax({
url:"inc.php",
method:"POST",
data:$('#insert_form').serialize(),
beforeSend:function(){
$('#insert').val("Inserting");
},
success:function(data){
$('#insert_form')[0].reset();
$('#plant_list_html').html(data);
}
});
5
https://convert.town/replace-new-lines-with-commas
https://convert.town/replace-new-lines-with-commas
5
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
///////
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo 'Page generat[...]
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
///////
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo 'Page generated in '.$total_time.' seconds.';
display: flex;
align-items: center; /* t-b */
justify-content: center; /* l-r */
display: flex;
align-items: center; /* t-b */
justify-content: center; /* l-r */
23
https://wordpress.stackexchange.com/questions/25885/a-way-to-automatically-install-pages-on-theme-install
$fount_post = post_exists( "My Post Title",'','','');
echo $fount_post ? "Found post at id #$fount_post" : "Can't find post!";
https://wordpress.stackexchange.com/questions/25885/a-way-to-automatically-install-pages-on-theme-install
$fount_post = post_exists( "My Post Title",'','','');
echo $fount_post ? "Found post at id #$fount_post" : "Can't find post!";
4
$('#sale_table').DataTable({
"order": [[ 0, 'desc' ]], "pageLength": 20} );
$('#sale_table').DataTable({
"order": [[ 0, 'desc' ]], "pageLength": 20} );
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Meilleur Avant')
.addItem('Etat Végétal', 'showEtatVegetal')
.addItem('Tartinade Cajou', 'showTartinadeCajou')
.addToUi();
}
function showEtatVegetal() {
var today = new Date();
[...]
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Meilleur Avant')
.addItem('Etat Végétal', 'showEtatVegetal')
.addItem('Tartinade Cajou', 'showTartinadeCajou')
.addToUi();
}
function showEtatVegetal() {
var today = new Date();
var dateInEightDays = new Date(today.getTime() + 8 * 24 * 60 * 60 * 1000);
var formattedDate = Utilities.formatDate(dateInEightDays, Session.getScriptTimeZone(), 'dd/MM/yyyy');
var ui = SpreadsheetApp.getUi();
var htmlOutput = HtmlService.createHtmlOutput('<h1 style="color:#87c6b5; text-align: center; font-size: 68px; font-weight: bold;">' + formattedDate + '</h1>')
.setWidth(500)
.setHeight(200);
ui.showModalDialog(htmlOutput, 'Etat Végétal (+ 7 jours demain)');
}
function showTartinadeCajou() {
var today = new Date();
var dateInFiftyDays = new Date(today.getTime() + 50 * 24 * 60 * 60 * 1000);
var formattedDate = Utilities.formatDate(dateInFiftyDays, Session.getScriptTimeZone(), 'dd/MM/yyyy');
var ui = SpreadsheetApp.getUi();
var htmlOutput = HtmlService.createHtmlOutput('<h1 style="color:#87c6b5; text-align: center; font-size: 68px; font-weight: bold;">' + formattedDate + '</h1>')
.setWidth(500)
.setHeight(200);
ui.showModalDialog(htmlOutput, 'Tartinade Cajou (+ 51 jours demain)');
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
2
http://192.168.0.207:8123/api/webhook/
http://192.168.0.207:8123/api/webhook/
1
https://betterstudio.com/blog/jquery-not-a-function-wordpress/
https://betterstudio.com/blog/jquery-not-a-function-wordpress/
7
function add_theme_scripts() {
wp_enqueue_script( 'main', get_template_directory_uri() . '/assets/js/main.js', array ( 'jquery' ), 1.1, true);
$variables = array(
'ajaxurl' => admin_url( 'admin-ajax.php' )
);
wp_localize_script('main', "jajax", $variabl[...]
function add_theme_scripts() {
wp_enqueue_script( 'main', get_template_directory_uri() . '/assets/js/main.js', array ( 'jquery' ), 1.1, true);
$variables = array(
'ajaxurl' => admin_url( 'admin-ajax.php' )
);
wp_localize_script('main', "jajax", $variables);
// add ajax variable to main.js
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_style( 'modal', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css', array(), '1.1', 'all');
wp_enqueue_script( 'fontawesome', 'https://kit.fontawesome.com/3267ecc051.js', array(), '1.1', false);
wp_enqueue_script( 'modal', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js', array ( 'jquery' ), 1.1, true);
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );
add_action("wp_ajax_action_name" , "action_name");
function action_name(){
// do things
}
add_action("wp_ajax_action_name" , "action_name");
function action_name(){
// do things
}
1
jkhhk
jkhhk