Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
@dexit
dexit / child-functions-php-snippet.php
Created November 21, 2019 12:32 — forked from lots0logs/child-functions-php-snippet.php
WordPress :: Divi Builder :: Contact Form Module :: Change the submit button text
<?php
/* DON'T copy the first line (above) if your functions.php already has it.
* ---------------------------------------------------------------------- */
function my_et_theme_setup() {
if ( class_exists( 'ET_Builder_Module_Contact_Form' ) ) {
get_template_part( 'my-main-modules' );
$et_pb_contact = new My_ET_Builder_Module_Contact_Form();
remove_shortcode('et_pb_contact');
@dexit
dexit / create-admin-user.php
Created April 16, 2020 09:08 — forked from wpscholar/create-admin-user.php
Create a new admin user in WordPress via code. Drop this file in the mu-plugins directory and update the variables, then load a page in WordPress to create the user. Remove the file when done.
<?php
add_action( 'init', function () {
$username = 'admin';
$password = 'password';
$email_address = '[email protected]';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
@dexit
dexit / pc-menu.js
Created April 28, 2020 20:57 — forked from neilgee/pc-menu.js
WooCommerce Accordion Style Expand/Collapse Product Category Menu
jQuery(document).ready(function($) {
/**
* WooCommerce Product Category Accordion jQuery Menu
* @link https://wpbeaches.com/woocommerce-accordion-style-expand-collapse-product-category-menu/
*/
if ($('ul.product-categories').length > 0) {
// Set variables
@dexit
dexit / isotope-init.js
Created April 28, 2020 20:58 — forked from neilgee/isotope-init.js
Isotope Filter Custom Taxonomy on CPT Archive Page
jQuery(document).ready(function($){
var $grid = $('.grid').isotope({
itemSelector: '.grid-item',
percentPosition: true,
layoutMode: 'fitRows',
});
// Layout Isotope after each image loads
$grid.imagesLoaded().progress( function() {
@dexit
dexit / accordion-repeater-shortcode.php
Created April 28, 2020 20:58 — forked from neilgee/accordion-repeater-shortcode.php
Bootstrap Accordion ACF Repeater
<?php //<~ don't add me in - add the code below in functions.php
add_shortcode( 'wpb_bs_accordion_acf', 'wpb_bs_accordion_acf' );
/**
* Bootstrap Accordion Repeater Field
*/
function wpb_bs_accordion_acf() {
ob_start();
<?php //<~ don't add me in - code below goes into functions.php
add_shortcode( 'wpb_accordion_acf', 'wpb_accordion_acf' );
/**
* Accordion Repeater Field
*/
function wpb_accordion_acf() {
ob_start();
// *Repeater
@dexit
dexit / login-out.php
Created April 28, 2020 20:59 — forked from neilgee/login-out.php
Login/Logout Shortcode
<?php //<~ remove if using in functions.php
add_shortcode( 'login_logut', 'login_logut' );
/**
* Add a login/logout shortcode button
* @since 1.0.0
*/
function login_logut() {
ob_start();
if (is_user_logged_in()) :
@dexit
dexit / acf-change-file-upload-directory.php
Created April 29, 2020 10:25 — forked from BODA82/acf-change-file-upload-directory.php
Change the upload directory of Advanced Custom Fields file upload field.
<?php
// ACF upload prefilter
function gist_acf_upload_dir_prefilter($errors, $file, $field) {
// Only allow editors and admins, change capability as you see fit
if( !current_user_can('edit_pages') ) {
$errors[] = 'Only Editors and Administrators may upload attachments';
}
// This filter changes directory just for item being uploaded
@dexit
dexit / functions.php
Created April 29, 2020 10:25 — forked from BODA82/functions.php
Custom WordPress Login Page
<?php
/********************************************************************************************
Example for customizing the WordPress login screen using your theme's functions.php file.
For @halo-diehard on wordpress.org forum:
https://wordpress.org/support/topic/codex-unclear-regarding-custom-login-page/
Relevant CODEX doc:
https://codex.wordpress.org/Customizing_the_Login_Form
*******************************************************************************************/
@dexit
dexit / custom-file-upload-form-in-wordpress.php
Created April 29, 2020 14:48 — forked from shamimmoeen/custom-file-upload-form-in-wordpress.php
Create custom file upload form in WordPress
<?php
if ( ! function_exists( 'wpcfu_output_file_upload_form' ) ) {
/**
* Output the form.
*
* @param array $atts User defined attributes in shortcode tag
*/
function wpcfu_output_file_upload_form( $atts ) {