Hooks, loops, functions
Att kunna
functions.php
- Filen för all custom phpstyle.css
- Filen för all custom cssfrontpage.php
- Mallen för statisk hemsidahome.php
- Mallen för blogginläggif ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
Ungefärligt översatt till PHP
foreach($posts as $post){
require 'post-content.php';
}
Funktioner som returnerar innehållet
$the_query = new WP_Query( $arguments );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
endwhile;
Vi måste skriva variabelnamnet före allt
$query = new WP_Query( array( 'author' => 5 ) );
$query = new WP_Query( array( 'category_name' => 'cats' ) );
$query = new WP_Query( array( 'tag' => 'sports' ) );
$query = new WP_Query(
array(
'tag' => 'sports',
'posts_per_page' => '10'
)
);
Bra lista på hjälpsamma funktioner
Vi har två sätt att modifiera innehåll via hooks
add_action('init', 'my_custom_function');
add_filter('the_title', 'my_title_function');
function profanity_filter($text) {
$words = array("illuminati", "big brother", "deep state");
/* str_replace checks for words in the array and removes them from
* the content in the post, returning a bleeped version */
return str_replace($words, "BLEEP", $text);
}
add_filter('the_content', 'profanity_filter');
Att tänka på: bilder
Använd Wordpress inbyggda bildhanteringssystem
Kör bilderna genom ImageOptim / FileOptimizer
Tänk på att ändra thumbnail size
Bestäm idag vilken typ av sida ni ska göra
Börja skissa upp upplägget: wireframes kan vara en bra idé
Informera mig om vad ni ska göra innan dagen är slut