how to get attached file url for current post?

try get_pages with ‘child_of’ => get_the_ID(), ‘parent’ => get_the_ID(), If you need i can post full code EDIT : if ( is_singular(‘post’) ) { $args = array( ‘post_type’ => ‘attachment’, ‘posts_per_page’ => -1, ‘post_status’ => null, ‘parent’ => $post->ID , ‘child_of’ => $post->ID, ‘sort_order’ => ‘desc’ ); $attachments = get_pages( $args ); if ( $attachments … Read more

How to use title attributes in sidebar widget?

You’r missing $post variable ( it is not defined and that for you don’t get post_name ). As a solution you could add global $post; You’r code would be like: <a href=”https://wordpress.stackexchange.com/questions/201956/<?php echo site_url(“/article/full-text/’); global $post; $slug = $post->post_name; echo $slug; ?>” title=”<?php the_title_attribute(); ?>”>Full Text</a>

Use wp_redirect to add a parameter

Use add_query_arg to make sure the url is created the right way. How is the wishlist link outputted? Trough wp_nav_menu? I would add it to the link on creation, so you don”t have to use wp_redirect.

Many Rewrite Parameters/Rules

The pattern (.+) matches any character, including the slash, so any combo of parameters will always match your first rule, with anything that follows being passed as the version query var. Change all instances of (.+) to ([^/]+) to match all characters except the slash.

Rewrite Most WordPress URLs

I think htaccess would be fastest way. Overhead of checking 50 simple regexp is very small – page generation is several orders of magnitude slower so you shouldn’t care about it. This wont hit performance, you can set rewrite only for domain mysite.com and it won’t check rules for tech.mysite.com reducing overhead, which isn’t noticeable … Read more

How to get image URL from media_sideload_image?

Try the fourth input parameter (available in 4.2+): @param string $return Optional. Accepts ‘html’ (image tag html) or “https://wordpress.stackexchange.com/questions/212512/src” (URL). Default ‘html’. So change your code snippet to: $new_image_url = media_sideload_image($new_url, $post_ID, $title, $src=”https://wordpress.stackexchange.com/questions/212512/src” ); to get the src instead of the default html. Note that the output might also be an WP_Error object for … Read more

get_template_directory() returns wrong address on VPS

You can read data on your server with file_get_contents(). If you want to make sure the file exists and is readable then use is_readable(). You don’t really need to use trailingslashit() in this case because you’re constructing the URI yourself. // path to file under current theme $json_file = get_template_directory() . ‘/inc/includes/acf-fonticonpicker/icons/selection.json’; // make sure … Read more

Pass form input via url variable

The first form: <form method=”post” action=”some-url.php”> <input type=”email” placeholder=”Email address” value=”” name=”email”> <input type=”submit” value=”Submit” name=”email-submit”> </form> Then in some-url.php: if( isset($_POST[’email’] ) $email = $_POST[’email’] The post method would be preferred here since it won’t create server log entries that include the user’s email address. You should also do this over SSL since you … Read more

How to remove /page/2/ from home page?

If the front page is set to display posts then the query for those posts will run regardless of wether your theme shows these posts or not. That’s why you’re getting pagination with no posts. You can test this by temporarily removing your themes front-page.php (or whatever it is). You should see all your posts … Read more

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