php string inside shortcode does not work

this should work <?php echo do_shortcode(‘[shortcode_products_by_brand title=”Promozioni” per_page=”12″ columns=”4″ orderby=”title” order=”desc” brand=”‘. $entity->getSlug() .'” operator=”IN”]’) ?>

Generate slug and meta data if meta field is empty

Ok, after a little playtime, here is the answer: add_action(‘save_post’, ‘ocp_jobs_save_details’); function ocp_jobs_save_details(){ global $post; $genref = sanitize_title( dechex( time() ) ); if ( $post->post_type == ‘job’ ) { if ( $_POST[‘ocp_jobs_ref’] ) { $jobs_args = array( ‘ID’ => $post->ID, ‘post_name’ => strtolower( sanitize_title( $_POST[‘ocp_jobs_ref’] ) ) ); $myref = strtoupper( $_POST[‘ocp_jobs_ref’] ); } else{ … Read more

Post as frontpage – avoid duplicate content

Your best way would be to redirect to the theme’s 404 page in the event that the page being loaded matches the slug that you are referring to. Try this: function check_undesirable_page(){ global $post; if(is_page() && ($post->post_name==”YOUR-SLUG-HERE”)){ global $wp_query; $wp_query->set_404(); status_header(404); } } add_action( ‘wp’, ‘check_undesirable_page’ ); EDIT: Also a good idea to incorporate the … Read more

Automatically remove repeated words in slug

According to your example ‘example.com/wordpress-how-to/how-to-create-a-child-theme-in-wordpress/’ search  = wordpress-how-to subject = how-to-create-a-child-theme-in-wordpress/ this code removes all the words from the subject found in search term. for more details check “Avoiding infinite loops” from save_post function modified_slug( $post_id ) { // If this is a revision, get real post ID if ( $parent_id = wp_is_post_revision( $post_id ) … Read more

Bulk-change Post slugs which have a suffix

First thing I would backup and restore the site on a local development environment. Then you can try use this tool on your local site: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ Make sure that when you rename you are giving them something unique otherwise you may get in trouble.

If file exists with page slug name show image else nothing

EDITED ANSWER – First get the full file path to your image and store it to a variable $filename. Use file_exists to check if image exists, and output the image and with it the title of your image. If the condition fails, there is no output. https://codex.wordpress.org/Function_Reference/wp_upload_dir <?php global $post; $slug = get_post( $post )->post_name; … Read more

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