Modify Blog Module layout in Child theme

Child theme are loaded first than parent theme. And unlike other template files functions.php of child theme get merged with parent theme’s functions.php instead of being overwritten. So a function i.e. et_pb_blog() declared in parent theme can not be re-declared in child theme. Solution: Remove the shortcode in child theme Add it again with child … Read more

Replace custom gallery shortcode with default gallery shortcode

Either make a regex filter as a the_content filter, add_filter(‘the_content’, ‘my_regex_filter’, 1); // Execute as early as possible function my_regex_filter($content) { $regex = get_shortcode_regex(array(‘showgallery’)); $content = preg_replace(“https://wordpress.stackexchange.com/”.$regex.’/s’, ‘[$1gallery$3$4$5$6]’, $content ); return $content; } or rewrite your add_shortcode function. remove_shortcode(‘showgallery’); add_shortcode(‘showgallery’, ‘my_showgallery’); function my_showgallery($args) { return gallery_shortcode($args); } I would recommend the second, because it is … Read more

Using shortcode to stop post content from displaying

Instead of use of shortcode, you can get the post content, format them the way you want and display them later. You can use get_the_content function; which will just retrieve post content in a variable. $raw_input = get_the_content(); /*process your content here and store the result in variable eg.*/ $raw_input = str_replace(“No”, “Yes”, $raw_input); print … Read more

Woocommerce products shortcode specific order

function woo_products( $atts ) { global $post; $product_Out=””; $atts = shortcode_atts( array( ‘product_ids’ => ”,// your product id goes here ), $atts, ‘bartag’ ); $pro_ids = explode(“,”, $atts[‘product_ids’]); foreach ($pro_ids as $key => $values) { $product_obj = $product = wc_get_product( $values ); //call your html and data in $product out variable $product_Out .= ‘<div class=”product_name”>’.$values.'</div>’; … Read more

latest posts shortcode with image

Image fix You are using the incorrect function to return the image source url. Change the_post_thumbnail_url( $post[“ID”] ) to get_the_post_thumbnail_url( $post[“ID”] ) see https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/ To fix the echo Use a $return variable like so: $out=”<div class=”recent-posts”>”; $out .= ‘<h1>’.$content.'</h1>’; foreach($recent_posts as $post){ $out .= ‘<div class=”updated”><p>’ . $post[‘post_title’] . ‘.<a href=”‘ . get_permalink($post[‘ID’]) . ‘”>’; … Read more

Load next post by ID on a single page

It seems that I found a solution to this and it is pretty easy. So I’m gonna post all the code for future uses: single.php <?php get_header(); ?> <?php $post = get_post(); $post_cat = get_the_category($post); $data = collection_data_json($post_cat[0]->term_id, $post->ID); $data_details = collection_order_permalink($data); $author_id = intval($post->post_author); ?> <script type=”text/javascript”> var cat = “<?php print $post_cat_id ?>”; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)