Skip to content

Instantly share code, notes, and snippets.

View cdsaenz's full-sized avatar

charly cdsaenz

View GitHub Profile
@cdsaenz
cdsaenz / home-slides.php
Created March 28, 2023 18:59
Home Sliders for WordPress, work in progress
<?php
/**
* Home Slides
* CSDev
*/
namespace CSDev;
?>
@cdsaenz
cdsaenz / functions.php
Created March 17, 2023 12:37
Hello Elementor Child With Bootstrap
<?php
/**
* Hello Elementor child theme
* Version 1.0 march 2023
* CSDev
*/
require_once get_stylesheet_directory() . '/includes/slider.php';
/**
* NAVWALKER BOOTSTRAP 5
* Extra levels
*/
.navbar.navbar-expand-lg .dropdown .dropdown-menu .dropdown-submenu {
/* dropdown sub menu positioning */
margin: 0;
left: 100%;
}
@cdsaenz
cdsaenz / wpinstall.sh
Created January 18, 2023 18:40 — forked from fmtarif/wpinstall.sh
#wp #bash #cli Install and initial set up for WordPress sites (uses WP-CLI)
#!/bin/bash
# get wp-cli
# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && sudo mv wp-cli.phar /usr/local/bin/wp
# wp-cli auto-completion
# wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash && source wp-completion.bash && echo -e "\nsource wp-completion.bash" >> .bashrc
#verify if wp-cli correctly installed
# wp --info
@cdsaenz
cdsaenz / 01-common-example.php
Created November 14, 2022 17:29 — forked from westonruter/01-common-example.php
Temporarily disabling filters in WordPress
<?php // Common way to do it:
remove_filter( 'the_title', 'wptexturize' );
$title = get_the_title();
add_filter( 'the_title', 'wptexturize' );
@cdsaenz
cdsaenz / wpml.md
Created November 8, 2022 16:12
WPML Notes

WooCommerce

  • Let products be managed automatically.
  • Edit categories in Taxonomy Translation, Product Categories.

Templates

  • Some pages I'll create a template (ie template-contact.php) with __('') strings inside
  • Pages with lot of text i'll create as template-contact_es.php etc loaded automatically by a function. The template will be just one which will invoke such function.

Theme strings

@cdsaenz
cdsaenz / Woo_WC_Product_Variable.php
Created October 4, 2022 00:51 — forked from gorkamu/Woo_WC_Product_Variable.php
Extended Woocommerce Variation Class
<?php
class Woo_WC_Product_Variable extends WC_Product_Variable {
public function get_all_variations() {
$available_variations = array();
foreach($this->get_children() as $child_id){
$variation = wc_get_product($child_id);
$available_variations[] = $this->get_available_variation($variation);
}
@cdsaenz
cdsaenz / .htaccess
Created September 29, 2022 23:16 — forked from thehashrocket/.htaccess
.htaccess file for CodeIgniter
AddDefaultCharset utf-8
# AddHandler php5-script .php
# AddHandler php4-script .php
# AddHandler php5-cgi .php
# Use PHP5 as default
AddHandler application/x-httpd-php5 .php
@cdsaenz
cdsaenz / vscode.txt
Created September 29, 2022 18:38
VSCode Find and Replace img src content with Codeigniter base_url
<img src="(.+?)"
<img src="<?= base_url('$1') ?>"
<img src='(.+?)'
<img src='<?= base_url('$1') ?>'
@cdsaenz
cdsaenz / VSCode-Regex-Search-Replace-Markdown-Images
Created September 29, 2022 18:37 — forked from dixonge/VSCode-Regex-Search-Replace-Markdown-Images
Regex to find markdown images and replace with img tag in VS Code (or template engine shortcode, etc.)
Find: !\[(.*?)\]\((.*?)\)
Replace: <img alt="$1" src="$2">