This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$obj = new stdClass(); | |
echo 'Object in var: '; | |
var_dump( $obj == true ); | |
echo '<hr>'; | |
echo 'Non-existent var: '; | |
@var_dump( $nonexistent_obj == true ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Basic update for site URL, does not update hard-coded content URLs but | |
-- should update properly generated permalinks and the basic site settings. | |
-- | |
UPDATE wp_options | |
SET option_value = REPLACE( option_value, 'http://www.oldhostname.com', 'http://www.newhostname.com' ) | |
WHERE option_value LIKE 'http://%'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-sm-6 col-md-4"><div class="thumbnail" style=" | |
background: red; | |
border: 0; | |
"><div class="caption" style=" | |
background: #fff; | |
padding: 0; | |
min-height: 318px; | |
margin: 0 3px; | |
"><h3 style=" | |
color: #fff; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Update options (site url, home) | |
-- | |
UPDATE wp_options | |
SET option_value = REPLACE( option_value, 'http://url1', 'http://url2' ) | |
WHERE option_value LIKE 'http://%'; | |
-- Update post content | |
-- | |
UPDATE wp_posts | |
SET post_content = REPLACE( post_content, 'http://url1', 'http://url2' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download, extract, move and delete WordPress source. | |
cd /path/to/project/docroot/ | |
wget http://wordpress.org/latest.tar.gz | |
tar zxvf latest.tar.gz | |
mv wordpress/* ./ | |
rm -rf latest.tar.gz wordpress | |
# now hit the URL in your browser and install ;] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assume: /path/to/sql/file/mydb.sql | |
cd /path/to/sql/file/ | |
mysql -u root -p | |
# passord | |
> use mydb; | |
> \. mydb.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gform_pre_render_1', 'szbl_gform_render_test' ); | |
function szbl_gform_render_test( $form ) | |
{ | |
foreach ( $form['fields'] as $key => $field ) | |
{ | |
if ( 'select' == $field->type ) | |
{ | |
if ( 5 == $field->id ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// single directory | |
foreach ( glob( dirname( __FILE__ ) . '/lib/*.php' ) as $file ) include $file; | |
// Or if you're doing 1 directory deep: | |
foreach ( glob( dirname( __FILE__ ) . '/lib/*.php' ) as $file ) include $file; | |
foreach ( glob( dirname( __FILE__ ) . '/lib/*/*.php' ) as $file ) include $file; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_init', 'szbl_redirect_subscribers' ); | |
function szbl_redirect_subscribers() | |
{ | |
$redirect_url = site_url( '/where-to-go/' ); | |
if ( is_user_logged_in() ) | |
{ | |
if ( !current_user_can( 'edit_posts' ) ) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Reference: https://codex.wordpress.org/Function_Reference/register_post_type | |
*/ | |
// hook into the "init" action | |
add_action( 'init', 'sam_register_post_types' ); | |
function sam_register_post_types() | |
{ |