Skip to content

Instantly share code, notes, and snippets.

View reza-qalekhani's full-sized avatar
😎
learning ...

Reza Qalekhani reza-qalekhani

😎
learning ...
View GitHub Profile
@reza-qalekhani
reza-qalekhani / functions.php
Created October 20, 2024 14:01 — forked from wpscholar/functions.php
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@reza-qalekhani
reza-qalekhani / wp-config.php
Created October 20, 2024 13:48 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@reza-qalekhani
reza-qalekhani / wp-paths.php
Created October 20, 2024 13:48 — forked from Yiannistaos/wp-paths.php
Determining Plugin and Content Directories in WordPress (Cheat Sheet)
<?php
echo "<h1>Determining Plugin and Content Directories in WordPress (Cheat Sheet)</h1>";
# PLUGINS
echo "<h2>PLUGINS</h2>";
echo plugins_url(). "<br>"; # http://wordpress.test/wp-content/plugins
echo plugins_url('akismet'). "<br>"; # http://wordpress.test/wp-content/plugins/akismet
echo plugins_url( 'assets/js/myscript.js', __FILE__ ). "<br>"; # http://wordpress.test/wp-content/plugins/assets/js/myscript.js
echo plugin_dir_url('') . "<br>"; # http://wordpress.test/wp-content/plugins/
@reza-qalekhani
reza-qalekhani / register-post-type.php
Created October 20, 2024 13:47 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public