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
function inhabitent_cpt_product() { | |
$args = array(); | |
register_post_type( 'product', $args ); | |
} | |
add_action( 'init', 'inhabitent_cpt_product' ); | |
## FLUSH PERMALINK CACHE When adding new content type or templates OR HAVING PROBLEMS ## | |
go to settings on dash | |
permalinks ---> save |
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
####### WAYS TO SORT TAXONOMYS ########## | |
Content audit : go through everything | |
ROT ANALYSIS: Redundant, out-dated or trivial? | |
Tree diagrams | |
Card sorting | |
######## Wordpress Taxonomies ########### | |
tags, categories, pages, 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
add_setup_theme . -order of initialization] | |
add_after | |
after_switch_theme . (action that happens IF a theme gets switched) | |
body_class | |
** excerpt_length - change length of custom excerpt (add to loop) |
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
What if we wanted to remove the Editor links from the Appearance/Plugins sub-menus so no internal end user can mess with code from inside WP? | |
// Remove "Editor" links from sub-menus | |
function inhabitent_remove_submenus() { | |
remove_submenu_page( 'themes.php', 'theme-editor.php' ); | |
remove_submenu_page( 'plugins.php', 'plugin-editor.php' ); | |
} | |
add_action( 'admin_menu', 'inhabitent_remove_submenus', 110 ); | |
The priority number is an optional integer value on a scale of 1 to 999 that determines the priority of order for functions tied to that specific hook. |
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
Actions vs. Filters | |
Actions Filters* | |
Used when something has to be added/done Used when something has to be changed | |
Declared with do_action() Declared with apply_filters() | |
Used with add_action() Used with add_filter() |
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
https://redacademy-dev-van.slack.com/files/U75NWHJDR/F7Z2MG24X/ppd_notes.txt |
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
Don't Forget! | |
When you build a WP theme, you want to make sure you include the following right before your closing <head> tag: | |
<!-- ...all of the <head> stuff above --> | |
<?php wp_head(); ?> | |
</head> | |
And this right before the closing body tag: | |
<!-- ...all of the <body> stuff above --> |
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
Like our sidebars, we must "register" all of the navigation menus we want to add to our WordPress theme: | |
In your functions.php file: | |
function my_theme_setup() { | |
register_nav_menus( array( | |
'primary' => 'Primary Menu', | |
) ); | |
} | |
add_action( 'after_setup_theme', 'my_theme_setup' ); |
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
To create a widgetized area in a WordPress theme, in your functions.php file you will need to add: | |
function my_widgets_init() { | |
register_sidebar( array( | |
'name' => esc_html( 'Sidebar' ), | |
'id' => 'sidebar-1', | |
'description' => '', | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h2 class="widget-title">', |
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 | |
// If comments are open or we have at least one comment, load up the comment template. | |
if ( comments_open() || get_comments_number() ) : | |
comments_template(); | |
endif; | |
?> |