This file contains 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 | |
/* | |
Plugin Name: My Custom Post Types | |
Description: Add post types for movies and movie reviews | |
Author: Liam Carberry | |
*/ | |
// Hook <strong>lc_custom_post_movie()</strong> to the init action hook | |
add_action( 'init', 'lc_custom_post_movie' ); | |
This file contains 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
// The custom function MUST be hooked to the init action hook | |
add_action( 'init', 'lc_register_movie_post_type' ); | |
// A custom function that calls register_post_type | |
function lc_register_movie_post_type() { | |
// Set various pieces of text, $labels is used inside the $args array | |
$labels = array( | |
'name' => _x( 'Movies', 'post type general name' ), | |
'singular_name' => _x( 'Movie', 'post type singular name' ), |
This file contains 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 | |
/* | |
* Global Functions | |
*/ | |
// Remove 'auto-paragraphing' from posts/pages | |
remove_filter( 'the_content', 'wpautop' ); | |
/* | |
* Admin Control Panel Functions |
This file contains 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
// Variables | |
$my_name = "Liam Carbery"; | |
// Functions | |
function display_my_name($name) { | |
echo $name; | |
} | |
// Clases | |
class Persons_Profile |
This file contains 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
// Associative array | |
$an_array = array( | |
"key" => "value", | |
"key2" => "value2" | |
); | |
// Standard Array | |
$another_array = array( | |
"one", | |
"two" |
This file contains 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 $string = "My 'alt' tag"; ?> | |
<img src="https://www.codeproject.com/KB/GDI-plus/ImageProcessing2/img.jpg" alt="<?php esc_attr( $string ); ?>"> |
This file contains 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
// Bad, messy | |
echo "Using \"quotation marks\" in a string can break out of the string"; | |
// Good, more readable | |
echo 'Using "quotation marks" in a string can break out of the echo statement'; |
This file contains 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
<p> | |
My <b>paragraph</b> of text which would probably introduce the list that's below. | |
</p> | |
<ul> | |
<li>Item 1</li> | |
<li>Item 2</li> | |
</ul> |
This file contains 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
/* Multisite */ | |
define( 'WP_ALLOW_MULTISITE', true ); |
This file contains 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
define('MULTISITE', true); | |
define('SUBDOMAIN_INSTALL', false); | |
define('DOMAIN_CURRENT_SITE', 'new-multisite-setup.dev'); | |
define('PATH_CURRENT_SITE', '/'); | |
define('SITE_ID_CURRENT_SITE', 1); | |
define('BLOG_ID_CURRENT_SITE', 1); |