mardi 1 décembre 2015

Pulling dates from wordpress using JOINS UNIONS and ORDER BY

I am trying to pull a list of events for a date range from wordpress. There is a custom type 'event'

Date range = '2015-12-01' to '2015-12-31'.

The first select solves the problem - however we also have events that are ongoing and are depicted by an end date of '2037-01-01' so any event fits into this category. Here is what I tried to get the correct results (it works but it's not pretty and I am sure someone can offer a better solution or point out mistakes)

select * from wp_15_posts wp 
join wp_15_term_relationships tr on tr.object_id = wp.ID and (term_taxonomy_id = 1707 or term_taxonomy_id = 1700 or term_taxonomy_id = 1701 or term_taxonomy_id = 1702 or term_taxonomy_id = 1703 or term_taxonomy_id = 1713 or term_taxonomy_id = 1704 or term_taxonomy_id = 3 or term_taxonomy_id = 1696 or term_taxonomy_id = 299 or term_taxonomy_id = 1695 or term_taxonomy_id = 1697 or term_taxonomy_id = 1698 or term_taxonomy_id = 1717 or term_taxonomy_id = 1705 or term_taxonomy_id = 1699 or term_taxonomy_id = 31 or term_taxonomy_id = 4 or term_taxonomy_id = 2 ) 
join wp_15_stack_eventmeta em3 on em3.stack_event_id = wp.ID and em3.meta_key = '_stack_event_end_date' and em3.meta_value >= '2015-12-01'
join wp_15_stack_eventmeta em4 on em4.stack_event_id = wp.ID and em4.meta_key = '_stack_event_end_date' and em4.meta_value <= '2015-12-31'
where wp.post_status = 'publish' and wp.post_type = 'event' group by wp.ID 
union
select * from wp_15_posts wp 
join wp_15_term_relationships tr on tr.object_id = wp.ID and (term_taxonomy_id = 1707 or term_taxonomy_id = 1700 or term_taxonomy_id = 1701 or term_taxonomy_id = 1702 or term_taxonomy_id = 1703 or term_taxonomy_id = 1713 or term_taxonomy_id = 1704 or term_taxonomy_id = 3 or term_taxonomy_id = 1696 or term_taxonomy_id = 299 or term_taxonomy_id = 1695 or term_taxonomy_id = 1697 or term_taxonomy_id = 1698 or term_taxonomy_id = 1717 or term_taxonomy_id = 1705 or term_taxonomy_id = 1699 or term_taxonomy_id = 31 or term_taxonomy_id = 4 or term_taxonomy_id = 2 ) 
join wp_15_stack_eventmeta em3 on em3.stack_event_id = wp.ID and em3.meta_key = '_stack_event_end_date' and em3.meta_value = '2037-01-01'
join wp_15_stack_eventmeta em4 on em4.stack_event_id = wp.ID and em4.meta_key = '_stack_event_end_date' and em4.meta_value = '2037-01-01'
where wp.post_status = 'publish' and wp.post_type = 'event' group by wp.ID order by 30



via Chebli Mohamed

ERR_CONNECTION_REFUSED in Wordpress

I have recently migrated my Wordpress site to a new host. Everything works smooth except pages generated by the plugin Paid Memberships Pro, that creates membership pages and subscription payment. The plugin generates all pages fine except the checkout pages that are hooked up to Stripe.

Trying to enter I get ERR_CONNECTION_REFUSED.

I am developing the site by having modified my DNS host file. This allows me to override the DNS for a domain, on a particular machine.

I have deleted and reinstalled the plugin. Rest of the plugin works. Same problem in all browsers and on different devices Should be no files pointing to the old site

Any suggestions for a solution would be very very welcome.

Thank you, Emil



via Chebli Mohamed

Wordpress and use conditional arrays

I use simple form for send values for search inside query for wordpress , but in some cases from this simple form no all values need search , in some cases one value or 3 values , etc , i use this for the search , this search based in attributes

$args = array
( 
'post_type'             => 'product',
'post_status'           => 'publish',
'ignore_sticky_posts'   => 1,
'orderby'               => $orderby,
'order'                 => $order,
'posts_per_page'        => $per_page,



'meta_query'=> array
(
array
(
'key'           => '_visibility',
'value'         => array('catalog', 'visible'),
'compare'       => 'IN'
)
),


'tax_query' => array
(
///
array
(
'taxonomy'      => 'pa_' . $attribute,
'terms'         => explode(",",$values),
'field'         => 'slug',
'operator'      => 'IN'
),

array
(
'taxonomy'      => 'pa_colors',
'terms'         => explode(",","Verdes"),
'field'         => 'slug',
'operator'      => 'IN'
),
///
)


);

The case it´s i need search in many moments more of 1 value , and for each new value i need put other array inside function , for example :

 array
   (
    'taxonomy'      => 'pa_colors',
     'terms'        => explode(",","Green"),
    'field'         => 'slug',
     'operator'         => 'IN'
     ),

    )

By this my question is if it´s possible put conditional ( as if , etc ) for each array , i know no right this syntax i writte now , but for understand my idea :

if(isset($_POST['colors']))
{
   array
       (
        'taxonomy'      => 'pa_colors',
         'terms'        => explode(",","Green"),
        'field'         => 'slug',
         'operator'         => 'IN'
         ),

        )
}

That´s my question , how i can do this , thank´s help me , and regards



via Chebli Mohamed

Solution to manage a rental property's bookings across multiple booking platforms

Morning/afternoon/evening all,

I am building a website for a rental property in France and the client wants to be able to use a single solution to manage bookings across the following platforms: Booking.com, AirBNB, Abritel (French) and Gites de France. Ideally, with the possibility of integrating TripAdvisor later.

So, when the centralised platform is updated, it updates across all the other platforms automatically. And when a booking is made, it feeds through to the centralised system.

I am highly doubtful that this one-shop solution exists but thought I would ask anyway. If it doesn't exist, would a bespoke solution be possible? Any other suggestions welcome.

Thank you



via Chebli Mohamed

Posts length by WordPress

Please help me with posts by WordPress. I need to pin 3 of the last post on the main page, for each post I could specify the number of words that it should be displayed, for example, for the first post I need 16 words, second post-22 words and for the third 19. Problem is to indicate different lengths posts . I tried to used plug-in "recent posts extended" there I can specify the length posts but it will be common for all.

Or maybe I can use any other widget for these purposes. Thank you!



via Chebli Mohamed

php Illegal string offset with similar_text function

I used wordpress 4.3.1 with php 5.6.14 version. I used this source code with my plugin:

$original = $wpcopy_options['option'];
$rewriten = $wpcopy_options['rewrite'];
$output = similar_text($original, $rewriten, $result);

I got this error:

Warning: Illegal string offset 'option' in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\... on line 15

Warning: Illegal string offset 'rewrite' in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\... on line 17



via Chebli Mohamed

Wordpress job listing/project management plugin

I want to ask for some help. We are a translation agency, and I'm looking for a plugin which would help us to hire our translators for specific translations. I listed the needed functions above, I need the closest solution, or a plugin that can be easily modified to do these things.

Only visible for registered users by us – There is no registration form, only we can register translators. Project list – We can list the current jobs with deadline, language pair, word count. Of course we have upload files too. User groups – We can group the users regarding to language pair (english-hungarian, chinese-german, etc.), and role (translator, and translator/proofreader), and the job is only visible to relevant translators. Instant hire – While we are working with tested translators, the first applicant gets the job automatically (captcha), and the project goes under his/her profile. While sometimes we need translator and proofreader too, or more translator for a specific project, we have to define the needed applicant number (with user role). E-mail notification – Every relevant translator/proofreader gets a notification for every listed job, and if it's still open 6 hours later, they get an another one. t. Project management – The job gets under the translator's profile, shared with the proofreader. They'll upload the final files here. We get e-mail notifications for every changes.

I appreciate every idea and comment. Thank you!



via Chebli Mohamed