How to use a capture from a rewrite rule inside a php file (like single.php)?

Nicolais Tip got me on the right track; Here is the working code: // add a query_var first add_filter(“query_vars”, function($vars) { $vars[] = “myTheme_podcast_time”; return $vars; }); add_filter(“rewrite_rules_array”, function($rules) { $newRules = array(); $newRules[“(.*)/time/([\d|\:]+)s?$”] = ‘index.php?name=$matches[1]&myTheme_podcast_time=$matches[2]’; $merged = array_merge($newRules, $rules); return $merged; }); And then in single.php: $time = get_query_var(“myTheme_podcast_time”); // do stuff

Try to showing product file size on product single page

Solution: Change from: $path = str_replace( site_url(“https://wordpress.stackexchange.com/”), ABSPATH, esc_url($each_download[“file”]) ); to: $ProductID = attachment_url_to_postid( $each_download[“file”] ); $path = get_attached_file( $ProductID ); And now work perfect…

custom post type single page

If you have a single page already, you shouldn’t be using a wp_query as well. Instead of these lines: <?php $args = array(‘post_type’ => ‘listing’); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> Use these lines: <?php // Start the loop. while ( have_posts() ) : the_post(); ?>

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