Skip to content

Instantly share code, notes, and snippets.

View nicomollet's full-sized avatar

Nico Mollet nicomollet

View GitHub Profile
@nicomollet
nicomollet / elementorcssinhead.php
Last active December 6, 2022 09:21
Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
<?php
/**
* Load Elementor styles on all pages in the head to avoid CSS files being loaded in the footer
*/
function elementor_css_in_head(){
if(class_exists('\Elementor\Plugin')){
$elementor = \Elementor\Plugin::instance();
$elementor->frontend->enqueue_styles();
}
if(class_exists('\ElementorPro\Plugin')){
@nicomollet
nicomollet / homeicon.php
Created July 25, 2017 13:05
Replace Home menu item by home icon
<?php
/**
* Replace Home menu item by home icon
*
* @param $sorted_menu_items
*
* @return mixed
*/
function homeicon_nav_menu_objects( $sorted_menu_items )
{
@nicomollet
nicomollet / gifticon.php
Last active July 25, 2017 13:04
Add gift icon the Shop menu item
<?php
/**
* Add gift icon the Shop menu item
*
* @param $sorted_menu_items
*
* @return mixed
*/
function gifticon_nav_menu_objects( $sorted_menu_items )
{
@nicomollet
nicomollet / responsiveimage.php
Created June 23, 2017 06:59
Insert responsive image
<?php
// Appeler une image de Média de la bibliothèque WordPress, avec l'ID de l'image en question
echo wp_get_attachment_image( 18662, 'large', false, ['class' => 'customclass', 'id' => 'customid']); // thumbnail, medium, large, full
?>
@nicomollet
nicomollet / elementor-category-posts-per-page.php
Last active September 10, 2019 14:16
Elementor: Force posts per page number for posts widget on Category Pages
<?php
/**
* Elementor: Force posts per page number for posts widget on Category Pages
*
* @param $query
*/
function elementor_category_posts_per_page( $query ) {
$category_id_or_slug = 'myslug';
@nicomollet
nicomollet / yoastseo-add-breadcrumb-link.php
Last active June 9, 2023 12:51
Yoast SEO add first link in breadcrumb
@nicomollet
nicomollet / yoastseo-remove-breadcrumb-link.php
Last active June 1, 2023 01:11
Yoast SEO remove breadcrumb link
@nicomollet
nicomollet / payline-payment-mean-admin-column.php
Created August 25, 2016 11:48
Adds Payline payment mean in orders screen.
<?php
// Payline : préciser le mode de paiement dans les commandes
add_action('manage_shop_order_posts_custom_column', 'payline_payment_mean_admin_column', 10, 2);
function payline_payment_mean_admin_column($column)
{
global $post;
switch ($column) {
case 'order_total' :
$paymentmean = get_post_meta($post->ID, 'Payment mean', true);
if(!empty($paymentmean)){
@nicomollet
nicomollet / owlcarousel.php
Last active June 29, 2016 12:54
Owlcarousel: default settings for all owlcarousels
<?php
// Owlcarousel: default settings for all owlcarousels
function custom_owlcarousel_shortcode_atts($defaults){
$args = array(
'post_parent' => '' // ID of Page containing images, default is current page ID
'order' => 'ASC', // Order
'orderby' => 'ID', // Orderby
'image_size' => 'large', // Image size: thumbnail, medium, large, full
'exclude' => '' // Exclude images by listing their IDs, separate by comma
@nicomollet
nicomollet / jetpack-sharing-text.php
Last active February 3, 2016 08:09
Jetpack remove sharing text
<?php
add_filter( 'jetpack_sharing_display_text', 'custom_jetpack_sharing_display_text', 10, 2 );
function custom_jetpack_sharing_display_text( $title ){
return '';
}