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
/* | |
Theme Name: Media Pons (Required) | |
Theme URI: https://media-pons.de/mediapons-base-theme/ (Optional) | |
Author: Media Pons (Optional) | |
Author URI: https://media-pons.de/ (Optional) | |
Description: Custom theme that is a base theme for developing example WordPress themes. This base theme uses Tailwindcss. (Optional) | |
Version: 1.0.0 (Optional) | |
License: GPLv2 or later | |
License URI: https://www.gnu.org/licenses/gpl-2.0.html (Optional) | |
Text Domain: media-pons (Optional - it should match the theme folder name) |
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 | |
// Here we use tax query but meta_query is also possible | |
// Unfortunately, there is no way to merge Wordpress default search behaviour, meta_query and tax_query using OR | |
// that I could find. | |
// Default behaviour for merging these queries are AND. | |
// Custom Elementor Query for Search | |
function mpons_custom_property_search_query($query) { | |
// Get the search term from the WP_Query object | |
$search_term = $query->get('s'); |
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 | |
/** | |
* @package MPonsCustomPlugin | |
*/ | |
/* | |
Plugin Name: MPons Custom Plugin | |
Plugin URI: https://mediapons.de | |
Description: This is an example plugin to practice WordPress Plugin Development. | |
Version: 1.0.0 |
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 | |
/* | |
* ABSPATH is a constant in WordPress that stores the absolute path to the WordPress installation directory on the server. | |
* It is defined in the core wp-config.php file like this: | |
*/ | |
define('ABSPATH', dirname(__FILE__) . '/'); | |
/* | |
* PURPOSE OF THE ABSPATH CHECK | |
* This check below guarantees that no one from outside of the WordPress installation should access this file directly. |
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 | |
// Check if GD is installed | |
if (!extension_loaded('gd')) { | |
die("GD library is not installed. Please enable it in your PHP configuration."); | |
} | |
// Set image dimensions and properties | |
$width = 1200; | |
$height = 900; | |
$backgroundColor = [240, 240, 240]; // Light gray background |
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 | |
// Show price suffix just on single product template but not on related products section | |
add_filter( 'woocommerce_get_price_html', 'custom_price_suffix', 10, 2 ); | |
function custom_price_suffix( $price, $product ) { | |
global $woocommerce_loop; | |
if(is_product() && ($woocommerce_loop['name'] != 'related')) { | |
$price = $price . ' <span class="leoshop-price-suffix"> Preis inkl. MwSt. & exkl. Versand</span>'; | |
} | |
return $price; | |
} |
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 | |
add_filter('ai1wm_exclude_content_from_export', function($exclude_filters) { | |
$exclude_filters[] = 'themes/your-theme-name'; | |
return $exclude_filters; | |
}); |
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 | |
// render elementor forms select item for year_built in Angebotsanfrage form | |
// rerender the select field using elementor form api | |
add_filter('elementor_pro/forms/render/item/select', function($item, $index, $form) { | |
if('vehicle_quote_form' === $form->get_settings_for_display('form_name') || 'vehicle_quote_form_popup' === $form->get_settings_for_display('form_name')) { | |
if('year_built' == $item['custom_id'] || 'year_built_popup' == $item['custom_id']) { | |
$item['field_options'] = "Bitte Jahr auswählen|\n"; | |
for($year=date('Y'); $year >= 1970; $year--) { | |
if($year != 1970) { | |
$item['field_options'] .= $year . "|" . $year . "\n"; |
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 | |
// FOR DEVELOPMENT PURPOSES, create a submenu page that displays the capabilities of | |
// Custom Post Type which is called Topic and this page is only available to ADMINS | |
add_action('admin_menu', 'mpons_forum_submenu'); | |
function mpons_forum_submenu() { | |
add_submenu_page( | |
'tools.php', | |
__('Media Pons Topic CPT', 'media-pons-forum'), | |
__('Media Pons Topic CPT', 'media-pons-forum'), |
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 | |
// Crocoblock Code Snippets | |
// Jet Smart Filters | |
// ----------------- | |
// Snippet No: 1 | |
// This code below sorts an array of filters that are related to a Custom Post Type | |
// Because Custom Post Type values are not coming in alphabetical order, this code is needed | |
// 601 is the Id of Jet Smart Filter Type | |
function theme_name_jet_filter_options( $options, $filter_id, $filter ){ |
NewerOlder