Skip to content

Instantly share code, notes, and snippets.

View Yorlinq's full-sized avatar
🏠
Working from home

Dennis Dallau Yorlinq

🏠
Working from home
View GitHub Profile
@Yorlinq
Yorlinq / Shortcode for 'Page title' - WordPress
Created July 23, 2022 09:38
Shortcode for 'Page title' - WordPress
// Shortcode for 'Page title': [yl_page_title]
function yl_page_title_shortcode() {
return get_the_title();
}
add_shortcode('yl_page_title','yl_page_title_shortcode');
@Yorlinq
Yorlinq / WhatsApp plugin for WordPress - Advanced Custom Fields
Last active July 23, 2022 11:15
WhatsApp plugin for WordPress - Advanced Custom Fields
// ACF fields
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5fb7906422ec4',
'title' => 'Yorlinq WhatsApp plugin',
'fields' => array(
array(
'key' => 'field_61fcc8b8c23be',
'label' => 'Algemeen',
@Yorlinq
Yorlinq / Dynamic order info plugin for WooCommerce - Advanced Custom Fields
Created July 23, 2022 11:14
Dynamic order info plugin for WooCommerce - Advanced Custom Fields
// Add ACF fields
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_61fb8a113f4f5',
'title' => 'Yorlinq Dynamic Order Info plugin',
'fields' => array(
array(
'key' => 'field_61fb9e02ae2fb',
'label' => 'Algemeen',
@Yorlinq
Yorlinq / Add custom stylesheet file - WordPress
Last active July 23, 2022 13:26
Add custom stylesheet file - WordPress
// Add custom stylesheet to WordPress header
wp_enqueue_style( 'yorlinq-layout', get_home_url() . '/wp-content/uploads/network/css/yl-styling.css' );
@Yorlinq
Yorlinq / Shortcode for 'Product name' by 'Product id' - WooCommerce
Last active July 23, 2022 13:36
Shortcode for 'Product name' by 'Product id' - WooCommerce
// Shortcode for 'Product name' by 'Product id': [yl_product_name id='']
function yl_product_name_shortcode( $atts ) {
$atts = shortcode_atts( array(
'id' => null,
), $atts );
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
$_product = wc_get_product( $atts['id'] );
$output = $_product->get_title();
}
@Yorlinq
Yorlinq / Shortcode for 'Product description' by 'Product id' - WooCommerce
Created July 23, 2022 13:38
Shortcode for 'Product description' by 'Product id' - WooCommerce
// Shortcode for 'Product description' by 'Product id': [yl_product_short_desciption id='']
function yl_product_short_desciption_shortcode( $atts ) {
$atts = shortcode_atts( array(
'id' => null,
), $atts );
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
$_product = wc_get_product( $atts['id'] );
$output = $_product->post->post_excerpt;
}
@Yorlinq
Yorlinq / Shortcode for 'Current product name' - WooCommerce
Created July 23, 2022 15:08
Shortcode for 'Current product name' - WooCommerce
// Shortcode for 'Current product name': [yl_current_product_name]
function yl_current_product_name_shortcode() {
global $product;
$output = get_the_title();
return $output;
}
add_shortcode( 'yl_current_product_name', 'yl_current_product_name_shortcode' );
@Yorlinq
Yorlinq / Shortcode for 'Product price' by 'Product id' - WooCommerce
Created July 23, 2022 15:11
Shortcode for 'Product price' by 'Product id' - WooCommerce
// Shortcode for 'Product price' by 'Product id': [yl_product_price id='']
function yl_product_price_shortcode($atts) {
$atts = shortcode_atts( array(
'id' => null,
), $atts );
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
$_product = wc_get_product( $atts['id'] );
$output = $_product->get_price_html();
}
@Yorlinq
Yorlinq / Shortcode for 'Product url' by 'Product id' - WooCommerce
Created July 23, 2022 15:15
Shortcode for 'Product url' by 'Product id' - WooCommerce
// Shortcode for 'Product url' by 'Product id': [yl_product_url id='']
function yl_product_url_shortcode($atts) {
$atts = shortcode_atts( array(
'id' => null,
), $atts );
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
$_product = wc_get_product( $atts['id'] );
$output = $_product->get_permalink();
}