Modifying posts based on category in TwentyTwentyTwo theme

I managed to solve my problem. So, the posts are using a single.html template file (in the TwenytTwentyTwo theme: /templates/single.html). I wanted to target a category class in the <body> element of the single.html. To make that happen, I had to modify the single.html file in my Child theme by adding the following code snippet … Read more

Developing an IP lookup function using an API

You’d have to use add_rewrite_rule so you can capture your desired url match and pass it on query_vars Something like; add_action(‘init’, function() { add_rewrite_rule(‘ip/(.+)/?$’,’index.php?ip_search=$matches[1]’,’top’); }); add_filter( ‘query_vars’, function( $vars ) { $vars[] = ‘ip_search’; return $vars; }); dont forget to flush the rewrite rule once you added your own rule, change the permalink settings back … Read more

How to display *block number* instead *date value* on WordPress posts?

I have no idea what a ‘block number’ is, but when themes output the date for a post they will use either the_date() or the_time() (or both). You can replace the output using the filters the_date() or the_time(): add_filter( ‘the_date’, function( $the_date, $format ) { $block_number=”whatever a block number is”; return $block_number; }, 10, 2 … Read more