Skip to content

Instantly share code, notes, and snippets.

@eminozlem
eminozlem / add_drop_caps.php
Created January 12, 2021 05:07 — forked from strangerstudios/add_drop_caps.php
Filter to add drop caps to first letter of blog posts in WordPress. Add to your active theme's functions.php.
/*
Drop cap first letter of each post.
*/
function add_drop_caps($content)
{
global $post;
//only posts
if(!empty($post) && $post->post_type == "post")
{
@eminozlem
eminozlem / gist:6b9c3cd26d33fe0a6aab37b6576f6d81
Created January 9, 2021 22:50
"WooCommerce database update done" stuck notice
function woocommerce_set_database_update_notice_as_actioned() {
// Bail if WoocCommerce notes class is not present.
if ( ! class_exists( 'WC_Notes_Run_Db_Update' ) ) {
return;
}
$woocommerce_notes_db = new WC_Notes_Run_Db_Update();
$woocommerce_notes_db->set_notice_actioned();
}
add_action( 'admin_notices', 'woocommerce_set_database_update_notice_as_actioned' );
@eminozlem
eminozlem / whmneedreboot
Created December 25, 2020 15:29
WHM You must reboot the server stuck
whmapi1 system_needs_reboot
#https://unix.stackexchange.com/a/447066
sudo grub2-set-default 0
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot
@eminozlem
eminozlem / gist:81b16196a2a363e4ed4a05e437cf0ce1
Last active August 14, 2020 06:10
woocommerce custom orderby
<ul class="orderme">
<?php
$catalog_orderby_options = apply_filters(
'woocommerce_catalog_orderby',
array(
'menu_order' => __( 'Default sorting', 'woocommerce' ),
'popularity' => __( 'Sort by popularity', 'woocommerce' ),
'rating' => __( 'Sort by average rating', 'woocommerce' ),
'date' => __( 'Sort by latest', 'woocommerce' ),
function wc_get_current_page_url() {
if ( is_home() ) {
$link = home_url();
} elseif ( is_shop() ) {
$link = get_permalink( wc_get_page_id( 'shop' ) );
} elseif ( is_product_category() ) {
$link = get_term_link( get_query_var( 'product_cat' ), 'product_cat' );
} elseif ( is_product_tag() ) {
$link = get_term_link( get_query_var( 'product_tag' ), 'product_tag' );
} else {
go to Dashboard > Elementor > Tools > Regenerate CSS > this should solve the problem
copy taxonomy-product_cat.php as well
@eminozlem
eminozlem / gist:3904458af7b070f1e2877af02999282b
Created July 22, 2020 05:21
//Change the 'Billing details' checkout label or other translations
add_filter( 'gettext', 'kk_translate_woocommerce_strings', 999, 3 );
function kk_translate_woocommerce_strings( $translated, $untranslated, $domain ) {
if ( ! is_admin() && 'woocommerce' === $domain ) {
switch ( $translated) {
case 'Sokak adresi' :
$translated = 'Adresiniz';
break;
case 'Fatura detayları' :
$translated = 'Gönderim & Fatura bilgileri';
add_action('wp_print_scripts', function () {
global $post;
if ( is_a( $post, 'WP_Post' ) && !has_shortcode( $post->post_content, 'contact-form-7') ) {
wp_dequeue_script( 'google-recaptcha' );
wp_dequeue_script( 'wpcf7-recaptcha' );
}
});
/* Small devices (landscape phones, 576px and up)*/
@media (min-width: 576px) {
}
/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
}