I am facing error in the wordpress single page php coding

You have few issues with your code: You haven’t added php start code syntax properly at few places ( i.e. you should write <?php instead of <? ). You’ve to end endif loop with a Semicolon (;). You have to remove ““““ appearing at the end of the code. By implementing these fixes, your existing … Read more

How to secure my php forms

It’s not the code in the form, but how you process the form’s data. I put this in my main ‘include’ file; it sanitizes all input data. The key is to never trust the form data without verifying it is valid. This code helps in that. // this sanitizes all gets/posts for security $_GET = … Read more

Yoast Breadcrumbs Inject Multiple Levels

My quick and dirty solution was to nest 2 arrays and loop through them. You’ll need to hard-code your nth level URLs. This example singles out a specific custom post type. function yoast_seo_breadcrumb_append_link( $links ) { global $post; if ((is_singular(‘team-members’))) { $breadcrumbs[] = array( array( ‘url’ => site_url(‘/our-firm/’), ‘text’ => ‘Our Firm’ ), array( ‘url’ … Read more

Limit the number of characters/words in an excerpt for a related posts section

You can use the get_the_excerpt filter to modify what’s printed by the_excerpt(): add_filter( ‘get_the_excerpt’, ‘wpse_367505_excerpt’ ); function wpse_367505_excerpt( $excerpt ) { return substr( $excerpt, 0, 50 ) . ‘ [Read More]’; } You can change the [Read More] text to whatever you’d like. Add this code to your theme’s functions.php file, and it should automatically … Read more

Current WordPress Page Title as Search Parameter into A Tag

Your shortcode is getting the title, but you haven’t told it to return anything, so a small tweak should fix things: <?php function post_title_shortcode(){ return get_the_title(); } add_shortcode(‘post_title’,’post_title_shortcode’); ?> You could also continue setting get_the_title() to $variable and add a line to return $variable, but the above is the simplest, shortest option.