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 class="container"> | |
<form id="contact" action="" method="post"> | |
<h3>Colorlib Contact Form</h3> | |
<h4>Contact us for custom quote</h4> | |
<fieldset> | |
<input placeholder="Your name" type="text" tabindex="1" required autofocus> | |
</fieldset> | |
<fieldset> | |
<input placeholder="Your Email Address" type="email" tabindex="2" required> | |
</fieldset> |
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> | |
<button id="button" class="btn" type="button">Show Dialog</button> | |
<div class="dialog"> | |
<div class="modal-md"> | |
<h1> | |
Pure JS Dialog | |
<span class="close">×</span> | |
</h1> | |
<div class="modal-content"> | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eu interdum diam. Donec interdum porttitor risus non bibendum. Maecenas sollicitudin eros in quam imperdiet placerat. Cras justo purus, rhoncus nec lobortis ut, iaculis vel ipsum. Donec dignissim arcu nec elit faucibus condimentum. Donec facilisis consectetur enim sit amet varius. Pellentesque justo dui, sodales quis luctus a, iaculis eget mauris. Aliquam dapibus, ante quis fringilla feugiat, mauris risus condimentum massa, at elementum libero quam ac ligula. Pellentesque at rhoncus dolor. Duis porttitor nibh ut lobortis aliquam. Nullam eu dolor venenatis mauris placerat tristique eget id dolor. Quisque blandit adipiscing erat vitae dapibus. Nulla aliquam magna nec elementum tincidunt. |
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
$args = [ | |
'taxonomy' => 'product', // Taxonomy type | |
'hide_empty' => false, // Display all categories including empty ones too | |
'exclude' => 15 // ID of default, uncategorized category or any taxonomy (optional) | |
]; | |
$topLevelCategories = get_categories($args); // Query to get all categories | |
$childCategories = getChildCategories($topLevelCategories); | |
function getChildCategories($categories) { |
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 makeMultidimensionalArray(inputArray, arraysCount = 20, arrayLength = 1) { | |
return [...Array(arraysCount)] // Create an array with number of elements (default = 20) | |
.map((item, index) => { | |
return Array(arrayLength).fill(inputArray[index]) // Make an inner array with the length of "index" (default = 1) | |
}) | |
} |
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 | |
/** | |
* SOURCE: https://stackoverflow.com/questions/52937409/create-programmatically-a-product-using-crud-methods-in-woocommerce-3 | |
*/ | |
/* THE CODE FUNCTION */ | |
// Custom function for product creation (For Woocommerce 3+ only) | |
function create_product( $args ){ | |
global $woocommerce; |
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 | |
/** | |
* Gets all products by category ID | |
* Original source: https://wordpress.stackexchange.com/questions/143582/get-the-product-list-of-a-given-category-id | |
*/ | |
<ul class="relatedlinks"> | |
<?php | |
$args = [ | |
'post_type' => 'product', |
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 | |
/** | |
* Disable Theme Editor | |
* Source: http://guides.beanstalkapp.com/deployments/deploying-wordpress.html | |
*/ | |
function remove_editor_menu() { | |
remove_action('admin_menu', '_add_themes_utility_last', 101); | |
} |
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 /* This function attaches the image to the post in the database, add it to functions.php */ | |
function insert_attachment($file_handler,$post_id,$setthumb='false') { | |
// check to make sure its a successful upload | |
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false(); | |
require_once(ABSPATH . "wp-admin" . '/includes/image.php'); | |
require_once(ABSPATH . "wp-admin" . '/includes/file.php'); | |
require_once(ABSPATH . "wp-admin" . '/includes/media.php'); |
OlderNewer