Skip to content

Instantly share code, notes, and snippets.

View uhlhosting's full-sized avatar
🏠
Working from home

Viorel-Cosmin Miron uhlhosting

🏠
Working from home
View GitHub Profile
@swinggraphics
swinggraphics / oxy-save-rendered-content.php
Last active June 15, 2022 21:56
Copy compiled Oxygen page content to post_content for search
/* Copy compiled Oxygen page content to post_content for search */
function sg_save_rendered_page_content( $meta_id, $object_id, $meta_key, $meta_value ) {
// Debugging
// $debug .= preg_replace( '#(\[/[^\]]+?\])#', "$1\n", $meta_value );
// file_put_contents( plugin_dir_path( __FILE__ ) . 'debug.html', $debug );
if ( 'ct_builder_shortcodes' != $meta_key ) return;
// Don't try to render anything with inner content
if ( false !== strpos( $meta_value, '[ct_inner_content' ) ) return;
@loorlab
loorlab / README.md
Created October 11, 2020 07:34 — forked from Alicannklc/README.md
WordPress Kod Arşivi
merge_slashes on;
if ($request_uri ~* "\/\/+") {
rewrite ^/(.*) $scheme://$host/$1 permanent;
}
@nginx-gists
nginx-gists / ubuntu_install.sh
Last active May 31, 2024 10:15
Automating Installation of WordPress with NGINX Unit on Ubuntu
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ];then
>&2 echo "This script requires root level access to run"
exit 1
fi
if [ -z "${WORDPRESS_DB_PASSWORD}" ]; then
>&2 echo "WORDPRESS_DB_PASSWORD must be set"
>&2 echo "Here is a random one that you can paste:"
<?php
// Valid values: development, staging and production. To get this value use: wp_get_environment_type()
defined( 'WP_ENVIRONMENT_TYPE' ) or define( 'WP_ENVIRONMENT_TYPE', 'production' );
define('DB_NAME', 'fill in db name');
define('DB_USER', 'fill in username');
define('DB_PASSWORD', 'fill in db password');
define('DB_HOST', 'localhost');
@hmowais
hmowais / functions.php
Created August 7, 2020 14:27
Gravity Form + Modal Popup (Natural Website)
<?php
function theme_enqueue_styles() {
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'avada-stylesheet' ) );
wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/assets/css/custom.css', array() );
wp_enqueue_style( 'responsive-style', get_stylesheet_directory_uri() . '/assets/css/responsive.css', array() );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
@dbkinghorn
dbkinghorn / netplan2NM.sh
Created June 23, 2020 17:07
Change Ubuntu 20.04 server netplan to use NetworkManager instead of networkd
#!/usr/bin/env bash
# netplan2NM.sh
# Ubuntu server 20.04 Change from netplan to NetworkManager for all interfaces
echo 'Changing netplan to NetowrkManager on all interfaces'
# backup existing yaml file
cd /etc/netplan
cp 01-netcfg.yaml 01-netcfg.yaml.BAK
@wp-seopress
wp-seopress / oxygen-automatic-meta-description.php
Last active February 9, 2021 17:54
Automatic meta description for Oxygen Builder
//Oxygen Builder Generate automatic meta description
function sp_titles_template_variables_array($array) {
$array[] = '%%oxygen%%';
return $array;
}
add_filter('seopress_titles_template_variables_array', 'sp_titles_template_variables_array');
function sp_titles_template_replace_array($array) {
if ( is_plugin_active( 'oxygen/functions.php' ) && function_exists( 'ct_template_output' ) && ! isset( $_GET['ct_builder'] ) ) {
add_filter( 'wp_doing_ajax', '__return_true' );
@ihorvorotnov
ihorvorotnov / functions.php
Last active March 17, 2021 10:01
Painless 3rd party marketing scripts in WordPress
<?php
// Enqueue all js codes combined in a single file.
function enqueue_theme_assets()
{
wp_enqueue_script(
'trackers',
get_stylesheet_directory_uri() . '/js/trackers.js',
null,
null,
@zackpyle
zackpyle / *Best Snippets*
Last active May 1, 2024 20:05
Best PHP/JS Snippets
This is a collection of my most used or most useful PHP and JS snippets
**Disclaimer, I didn't write most of these - I just curated them over the years**