I don’t understand how this parameter works..?

Let’s see if we can break it down so it’s easy to understand. You have a PHP function named ‘cm_title’: function cm_title($text) { return ‘TESTING  ’ . $text; } It only does 1 thing. It takes what it is given, ‘$text’, and returns that $text with the words ‘Testing ‘ prepended to it. How does … Read more

Web scraping using transients

Try something like this, which would save in transient for 12 hours. Let me know if anything does not make sense. <?php $value = get_transient( ‘value’ ); if ( false === $value ) { $output = “”; $html = file_get_contents(‘http://www.example.com’); $doc = new DOMDocument(); libxml_use_internal_errors(TRUE); // disable libxml errors if(!empty($html)) { $doc->loadHTML($html); libxml_clear_errors(); $xpath = … Read more

Excerpt unwanted text “”

This little function I created to see what happends when… Outcome here was showing the excerpt as wished when filled out in backend and if left empty it keeps blank. I have no idea why you have filter it that way but that is the way you wish I assume. add_filter( ‘get_the_excerpt’, ‘if_excerpt_left_empty_show_this’ ); function … Read more

How to only show page id as body class?

Honestly, it’s source code. The only people who see it are you and other developers. Anybody casually visiting your website will never know or understand this stuff so really there’s no harm keeping it there. Buttttt… if you want to get rid of it you could filter body_class: function custom_body_class( $classes ) { global $post; … Read more

Placing raw HTML inside a WordPress shortcode

For the sake of having @Milo’s comment as an answer. Your code works as it should, it is just not possible to “write” HTML in the visual editor also in shortcodes. Shorcodes are not treated differently then any other text. If you want formatted HTML in your shortcode you just need to use the normal … Read more