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
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
####### 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
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
VERY IMPORTANT | |
<?php | |
/** | |
* Template Name: About Page | |
* | |
* @package RED_Starter_Theme | |
*/ |
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
Create page from page.php | |
Create page in pages | |
Label Template in PHP file (comments in top) | |
Create fields, choose page template (links to page.php template label) | |
Go to page, select template file, get the field |
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 inhab_dynamic_css() { | |
if ( ! is_page_template( 'about.php')) { | |
return; | |
} | |
$image = CFS()->get('about_header_image') ; | |
if (! $image) { | |
return; |
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
Use WP_Query when you need to create a paginated query | |
Use get_posts() to create static, additional loops (e.g. a list of a few recent posts on a homepage, etc.) | |
############## DEFAULT LOOP | |
<?php if ( have_posts() ) : ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<h2><?php the_title(); ?></h2> ###### POST TITLE | |
<?php the_content(); ?> ###### POST CONTENT | |
<?php endwhile; ?> |
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
<img src= "<?php echo get_template_directory_url() . '/images/inhab-logo.svg' ?>" |
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
appearance ###########Adding a new archive page (products) | |
menus | |
products (screen options) | |
view all | |
archives | |
add | |
rename - shop | |
url - product | |
(create archive-product.php) | |
get $terms - taxonomy - product-type |