Skip to content

Instantly share code, notes, and snippets.

/* Dynamic Navigation */
<?php
wp_nav_menu(array(
'menu' => 'main_menu',
'theme_location' => 'main_menu',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'navbar-collapse-1',
'menu_class' => 'nav',
'depth' => '3',
@mohsinworld
mohsinworld / Disable Gutenberg Editor
Created December 11, 2018 20:34
Use this cde inside functions.php
// Gutenberg disable for posts
add_filter('use_block_editor_for_post', '__return_false', 10);
Variable
String
Constant
Condition [if, else, elseif]
Loop
Function
Array
@mohsinworld
mohsinworld / Remove Only Featured Image When Delete Post
Last active June 6, 2019 05:42
This code need to use in functions.php file (themes files)
add_action( 'before_delete_post', 'wps_remove_attachment_with_post', 10 );
function wps_remove_attachment_with_post($post_id)
{
if(has_post_thumbnail( $post_id ))
{
$attachment_id = get_post_thumbnail_id( $post_id );
wp_delete_attachment($attachment_id, true);
}
@mohsinworld
mohsinworld / Remove Media, Featured Image When Post Delete (uploaded to this post only)
Last active June 6, 2019 05:58
Need to paste this code inside of functions.php file (themes File)
add_action( 'before_delete_post', 'wps_remove_attachment_with_post', 10 );
function wps_remove_attachment_with_post( $post_id ) {
/** @var WP_Post[] $images */
$images = get_attached_media( 'image', $post_id );
foreach ( $images as $image ) {
wp_delete_attachment( $image->ID, true );
}
}
define('EMPTY_TRASH_DAYS', 1);
define( 'WP_POST_REVISIONS', 1 );
<center>
<strong>Some Radio Station from Your Country</strong>
[geot country="AF"][ess_grid alias="Afghanistan"][/geot]
[geot country="AL"][ess_grid alias="Albania"][/geot]
[geot country="DZ"][ess_grid alias="Algeria"][/geot]
[geot country="AD"][ess_grid alias="Andorra"][/geot]
[geot country="AO"][ess_grid alias="Angola"][/geot]
[geot country="AG"][ess_grid alias="Antigua and Barbuda"][/geot]
[geot country="AR"][ess_grid alias="Argentina"][/geot]
[geot country="AM"][ess_grid alias="Armenia"][/geot]
h1 {
font-family: 'Open Sans', Helvetica, Arial, Lucida, sans-serif;
}
p {
font-family: 'Open Sans', Helvetica, Arial, Lucida, sans-serif;
}
b {
font-size: 30px;
color: #BBB743;
font-family: 'Open Sans', Helvetica, Arial, Lucida, sans-serif;
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "https://mohsinalam.com/mobile/";
}
//-->
</script>
"https://mohsinalam.com/mobile/" would be replaced with the location of wherever your mobile version resides. This technique could be adapted to load an alternate stylesheet as well.