get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title

Not sure if this’ll work for you because I don’t know if $attachment_ID in the function is returning anything at all… …but assuming it is: function custom_pic_alt( $attachment_ID ) { //var_dump( $attachment_ID ); //uncomment this and see if it even returns anything. $thumb_alt = get_post_meta( $attachment_ID, ‘_wp_attachment_image_alt’, true ); $thumb_caption = wp_get_attachment_caption( $attachment_ID ); $thumb_title … Read more

Duplicated tag in loop

Seems like one of your ACF fields contain a <a> tag in them. In HTML you cannot have and <a> tag inside another <a> tag. Check the ACF fields the_field(‘feature_item_title’) and the_field(‘hero_subtitle’), check their content, most likely you will find a <a> tag in one of them, remove it and your html will be structured … Read more

WordPress custom pages in a folder

Something like this: In your child theme, create a directory to hold your template files as desired; e.g. a “custom_pages” directory, with the according 10 template php files holding the code for these 10 pages inside, like my_page_1.php, my_page_2.php, and so on. Also in your child theme folder; you setup ONE template file like my_custom_page.php; … Read more

different sidebars depending on template (is_page_template is not working)

One possiblilty: Keep the new code in sidebar.php in your child theme. In blog-page.php, change the line get_sidebar(‘blog-sidebar’); to do_action( ‘storefront_sidebar’ ); (as in an original page.php). Tested in a blog-page.php page template without custom query and loop, and also no woocommerce installed, this should work. If not, the custom query and loop might interfere. … Read more

Random home page at each refresh between array of page IDs

Not tested well but you can try this. add_action( ‘template_redirect’, ‘my_homepage_redirect’ ); function my_homepage_redirect() { if ( is_home() || is_front_page() ){ $page = get_posts( [ ‘post_type’ => ‘page’, ‘posts_per_page’ => 1, ‘orderby’ => ‘rand’, ‘fields’ => ‘ids’ ] ); if ( empty( $page ) ){ return; } // update the front page id option according … Read more

How to create additional rendering for custom post types?

You need to use add_rewrite_tag and add_rewrite_rule functions to first register your custom URL handlers. Something like add_rewrite_tag( ‘%custom_render%’, ‘true’ ); add_rewrite_rule( ‘([^/]+)/custom_render/?$’, ‘index.php?name=$matches[1]&custom_render=true’, ‘top’ ); And then you can us template_inclide hook to check if the query param custom_render is set, then return the name of the new template. Note: You need to flush … Read more