Skip to content

Instantly share code, notes, and snippets.

View pavelrich's full-sized avatar
🌍
Working

Pavel Richter pavelrich

🌍
Working
View GitHub Profile
@pavelrich
pavelrich / functions.php
Last active October 22, 2021 00:14
WooCommerce — Check if WooCommerce Plugin is Activated
<?php
if ( ! function_exists( 'prefix_woocommerce_activated' ) ) {
/**
* Check if WooCommerce Plugin is Activated
*/
function prefix_woocommerce_activated() {
if ( class_exists( 'woocommerce' ) ) {
@pavelrich
pavelrich / functions.php
Last active October 22, 2021 00:13
WooCommerce — Breadcrumbs — Change "Home" to the Blog Name
<?php
if ( ! function_exists( 'prefix_woocommerce_breadcrumb_defaults' ) ) {
/**
* Change Breadcrumbs "Home" to the Blog Name
*
* @param $defaults
*
* @return mixed
@pavelrich
pavelrich / functions.php
Created November 14, 2018 01:42
WooCommerce — Move coupon code field
<?php
// Move coupon code field
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
add_action( 'woocommerce_after_checkout_form', 'woocommerce_checkout_coupon_form' );
@pavelrich
pavelrich / functions.php
Last active October 26, 2018 18:05
WooCommerce — Display excerpt on product listing on the archive page
<?php
if ( ! function_exists( 'forqy_woocommerce_products_excerpt' ) ) {
function forqy_woocommerce_products_excerpt() {
?>
<div class="fy-product-excerpt">
<?php the_excerpt(); ?>
</div>
@pavelrich
pavelrich / functions.php
Created May 30, 2018 17:44
WordPress — Remove page templates from the "Page Attributes" metabox if custom post type doesn't exists
<?php
if ( ! function_exists( 'forqy_remove_page_templates' ) ) {
function forqy_remove_page_templates( $templates ) {
// Project
if ( ! post_type_exists( 'project' ) ) {
unset( $templates['template-portfolio.php'] );
unset( $templates['template-portfolio-categories.php'] );
@pavelrich
pavelrich / functions.php
Created May 17, 2018 10:19
WordPress — Add Custom Class to Menu Item
<?php
if ( ! function_exists( 'forqy_navigation_item_add_class' ) ) {
function forqy_navigation_item_add_class( $classes = array(), $menu_item = false ) {
$classes[] = 'custom-class';
return $classes;
@pavelrich
pavelrich / functions.php
Created December 11, 2017 12:32
Salmon: Unregister events
<?php
// Unregister events
if ( ! function_exists( 'salmon_unregister_event' ) ) {
function salmon_unregister_event() {
unregister_post_type( 'event' );
}
@pavelrich
pavelrich / wp-config.php
Last active August 21, 2018 13:00
Increase PHP memory limit for WordPress
<?php
// Increase PHP memory limit for WordPress
define( 'WP_MEMORY_LIMIT', '256M' );
// Increase PHP time limit for WordPress
set_time_limit( 300 );
@pavelrich
pavelrich / functions.php
Last active November 28, 2017 23:53
WordPress: Remove all theme modification options for current theme
<?php
if ( ! function_exists( 'forqy_remove_theme_mods' ) ) {
function forqy_remove_theme_mods() {
// https://codex.wordpress.org/Function_Reference/remove_theme_mods
remove_theme_mods();
}
add_action( 'after_setup_theme', 'forqy_remove_theme_mods' );
@pavelrich
pavelrich / functions.php
Created October 6, 2017 10:37
Set Datepicker Defaults
// Set Datepicker Defaults
if ( ! function_exists( 'forqy_datepicker_defaults' ) ) {
function forqy_datepicker_defaults() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function ($) {