WP_query returns error when used for custom widget

UPDATE: Okay, Looking at the Error, it should be easy. Just remove any Whitespaces or Clear Lines at the end of your Plugin file after the last “?>”. http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc Did you copy&paste the code here? Because it seems like you have some whitespaces that should not be there in the line <?php if ($the_query->have_posts()) : … Read more

Filter and display a specific custom field value [closed]

Now with the new information I would go with this: ?> <form method=”post” action=”where_ever_you_want_to_point_the_user_afterwards.php”> /* The loop: */ if (the_field(‘departures’) == ‘user_departure_location’) { <input type=”radio” name=”destination” value=”<?php echo the_field(‘destination’); ?>”> <a href=”https://wordpress.stackexchange.com/questions/154925/<?php the_permalink(); ?>”> Destination: <?php the_field(‘destination’); ?> Departing from:<?php the_field(‘departures’); ?> Price:<?php the_field(‘price’); ?> </a> } /* The loop end */ ?></form> And then … Read more

Get custom fields when hover link of post

I would just put the custom fields in the <li> after the <a> and then show/hide them with your preferred tooltip method, whether it be CSS, JS or a combination of the two: <?php if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/155135/<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>” … Read more

Paying to Access Custom Fields Per Post

This sounds like custom development work, I doubt there is a pre-built solution. At its most basic, I’d say you need to a membership solution. There are a several out there, some free, some premium. Then in your front-end you can wrap the display of all the custom fields with current_user_can() using a capability that … Read more

Add custom field to post with some part of url as value

I found this solution, it works great. I will share it here if someone else need it. $currenturl=”http://” . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’]; $id = $post->ID; if ( preg_match(‘/\?(.+)$/’, $currenturl, $matches) ) { $value = urldecode($matches[1]); add_post_meta($id, ‘my_new_custom_field_name’, $value, true); }

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