Skip to content

Instantly share code, notes, and snippets.

Avatar

Dragi Postolovski dragipostolovski

View GitHub Profile
View custom_menu_admin.php
<?php
/**
* Add menu meta box
*
* @param object $object The meta box object
*
* @link https://developer.wordpress.org/reference/functions/add_meta_box/
*/
function pe_custom_add_menu_meta_box( object $object ) {
View pe-shortcode-content-boxed-style.php
<?php
/** Enqueuing the Stylesheet for two shortcode */
function pe_cta_enqueue_scripts() {
global $post;
$has_shortcode = has_shortcode( $post->post_content, 'pe_cta_button_shortcode' ) || has_shortcode( $post->post_content, 'boxed' );
if( is_a( $post, 'WP_Post' ) && $has_shortcode ) {
wp_register_style( 'pe-cta-stylesheet', plugin_dir_url( __FILE__ ) . 'css/pe-cta-style.css' );
View pe-shortcode-cta-button-style.php
<?php
/** Enqueuing the Stylesheet for the CTA Button Shortcode */
function pe_cta_enqueue_scripts() {
global $post;
if( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'pe_cta_button_shortcode') ) {
wp_register_style( 'pe-cta-stylesheet', plugin_dir_url( __FILE__ ) . 'css/pe-cta-style.css' );
wp_enqueue_style( 'pe-cta-stylesheet' );
View pe-shortcode-current-date.php
<?php
add_shortcode( 'pe_get_current_date_shortcode', 'pe_get_current_date' );
/**
* Return the current date.
*
* @return false|string
*/
function pe_get_current_date() {
return date('Y-m-d');
View datatrans-payments-api-intergration.php
<?php
/**
* Datatrans class for payments.
*
* https://docs.datatrans.ch/docs
* https://admin.sandbox.datatrans.com/
* https://testaccount.datatrans.com/testaccounts
*
* Class PE_Datatrans
View datatrans-secureFields-integration.js
// WordPress
jQuery(document).ready(function ( $ ) {
let payment = $('#your-button');
// let secureFields = new SecureFields();
let styles = {
// your style goes here
// Specific Style for Each Element
cardNumber: "border: 1px solid #eaeaea; height: 40px; padding: 10px; " +
View class-elementor-widget-carousel.php
View class-elementor-widget-base.php
<?php
use Elementor\Controls_Manager;
use Elementor\Group_Control_Background;
use Elementor\Plugin;
use Elementor\Widget_Base;
if ( ! defined( 'ABSPATH' ) ) {
// Exit if accessed directly.
exit;
View class-widget-name.php
<?php
use Elementor\Controls_Manager;
use Elementor\Group_Control_Background;
use Elementor\Plugin;
use Elementor\Widget_Base;
if ( ! defined( 'ABSPATH' ) ) {
// Exit if accessed directly.
exit;
View class-widgets.php
<?php
// We check if the Elementor plugin has been installed / activated.
if ( ! in_array( 'elementor/elementor.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
return;
}
/**
* Include the widgets and create a custom category.
*