Simple function based on queried page

12. February 2020

<?php
$term = get_queried_object();
$type = $term->post_type;
if ( $type === 'event' ) {
	if ( has_post_thumbnail() ) {
		$size = apply_filters( 'twstudio_default_thumbnail_size', 'large' );
		the_post_thumbnail( $size, array( 'class' => 'featured-image' ) );
	}
}
?>
Check if browser is IE

22. May 2019

Replace a text string in PHP/WordPress

8. March 2019

Check if user is logged in and do something

10. July 2018

 

Get site url

8. July 2018

Gives you the sites url..

<?php echo get_site_url(); ?>

Gives you a specific page:

Gives you an image:

Set the Thumbnail size

15. May 2018

This goes into your theme setup function in functions.php

(To register new sizes: https://developer.wordpress.org/reference/functions/add_image_size/.)

Hook example

8. May 2018

Add Taxonomies for media gallery

6. May 2018

Goes into functions.php

Ny first PHP code

24. April 2018

 

PHP/WP nice to know things

20. April 2018