Skip to content

Instantly share code, notes, and snippets.

@asadadams
Last active May 2, 2020 12:41
Show Gist options
  • Save asadadams/bb886883cd6d0a452f4fc3b0a73e76ad to your computer and use it in GitHub Desktop.
Save asadadams/bb886883cd6d0a452f4fc3b0a73e76ad to your computer and use it in GitHub Desktop.
Wordpress lookup
FUNCTIONS
bloginfo('title') - Website Title
bloginfo('description') - Website tagline
get_header() - get header.php
get_footer() - get footer.php
wp_head() - let wordpress to load whatever it needs in <head/>
wp_footer() - load all js footers and files needed in the footer
have_posts() - no of posts
the_post() - keep track of individual post
the_title() - title of post/page
get_the_title(ID) - title of post/page using ID
the_permalink() - permalink(slug) of post/page
the_content() - content of post/page
get_theme_file_uri('file path') - find path of file in your theme dir
site_url('') - get url of a page
get_the_ID() - get post/page id
wp_get_post_parent_id('ID') - get the ID parent post/page id
TEMPLATE FILES
single.php - for individual post
page.php - for pages
header.php - for header
footer.php - for footer
functions.php
add_action('wp_enqueue_scripts','FUNCTIONcall') - HEY WORDPRESS I WANT LOAD A SCRIPTS/CSS USING A FUNCTION CALLED FUNCTIONcall
wp_enqueue_style('STYLEnickname','LOCATION') - load script, in LOCATION use get_stylesheet_uri to load main style.css
wp_enqueue_script('SCRIPTnickname','LOCATION',DEPENDECIES,VERSION,true/false FOR LOADING JUST BEFORE CLOSING BODY TAG) - load script
add_action('after_setup_theme','FUNCTIONcall') - HEY WORDPRESS I WANT TO RUN A FUNCTION CALLED FUNCTIONcall AFTER THEME SETUP
add_theme_support('title-tag')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment