Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter florushj

    (@florushj)

    Hi @marcbelletre,

    I understand. The plug-in itself does a great job. Now I have got this working, it’s exactly what I needed and intuitive to work with. I’ve tried paying it forward by adding the dutch translation for this plug-in.

    I guess adding the agenda listing use case to the documentation would be a very good addition. That and listing all dates for the recurring event are arguably the most common use cases for this plug-in. If you could find the time..

    Thanks for all your help. Cheers!

    Thread Starter florushj

    (@florushj)

    Hi Marc, after some fiddling around with the plug-in I have made it work for my use case. Thanks for your help.

    Trying to query and show it all in an agenda style (with individual event entries for recurring events) is still a bit cumbersome.
    Managed to make it work by first querying all events (using WP_query) (normal and recurring ones), and then creating a new events array where normal events and individual event entries for the recurring ones ar pushed into. For recurring events I loop through them and for each individual date I push the post object with date to this events array.

    Thread Starter florushj

    (@florushj)

    @marcbelletre Could you possibly tell me if the code you provided works in your case?

    @thenax If the code provided by @marcbelletre works your case would be solved by setting posts per page to 1 and removing the end_date part of the meta_query. Like so. BUT (!) I did not get this to work.

    $start = new DateTime();
    
    // Set the end date to the next month (or use 'P1W' for the next week)
    $end = clone $start;
    $end->add(new DateInterval('P1M'));
    
    // Set both dates to midnight
    $start->setTime(0,0,0);
    $end->setTime(0,0,0);
    
    new WP_Query([
        'post_type' => 'event',
        'posts_per_page' => 1,
        'post_status' => 'publish',
        'meta_query' => [
            'relation' => 'AND',
            [
                'key' => 'start_date',
                'compare' => '<=',
                'value' => $end->format('Y-m-d'),
                'type' => 'DATE',
            ]
        ],
    ]);
    Thread Starter florushj

    (@florushj)

    Thanks for your quick response. However, I’m not able to get the code provided to work. My guess is that it has something to do with the following:

    You say that start_date and end_date post meta is set when saving the post, but when I check the database after saving a post with a recurring rule I can see the recurring rule is saved as post meta (in my case with meta_key recurring_rule). Like so:

    FREQ=DAILY;UNTIL=20220430T000000;DTSTART=20220401T000000;INTERVAL=1

    But there are no separate start_date and end_date meta_key named post meta fields? A meta query for the key start_date and end_date therefore can not work?

    Also, my second guess would have been the ->format('Y-m-d') part which I think should be ->format('Ymd')?

    Edit: After browsing through the plugin code I saw that the default return format was set to Y-m-d.

    • This reply was modified 2 years, 11 months ago by florushj.
    • This reply was modified 2 years, 11 months ago by florushj.
    • This reply was modified 2 years, 11 months ago by florushj.
    • This reply was modified 2 years, 11 months ago by florushj.
    • This reply was modified 2 years, 11 months ago by florushj.

    To fix this:

    Add this to your php.ini file
    max_input_vars = 3000

    Or add this to your .htaccess file in your wordpress root
    php_value max_input_vars 3000

    This problem has to do with the amount of characters there has to be updated in your database when you have a product with a lot of variations (and in my case different translations). The max is 1000, with one of these changes, everything should be working again.

    I SOOOOOO agree with this! This has given me headaches for at least three projects in a row now, and still I haven’t found a solution.

    @alchymyth.. what you said works, but shouldn’t it be possible to use remove_action etc to create a clean and nice way to start fresh with your child theme?

    if ( !function_exists( 'child_theme_setup' ) ):
    	function child_theme_setup() {
    
    /* put in all the stuff to clean up the twentyten functions and start fresh. e.g. remove custom header functionality, remove widgets etc..  */ 
    
    }
    endif;

    I don’t really know how to do this..

    I have a child functions.php file for my child theme. How do I completely remove this function? (Without altering the original functions.php file of the twentyten theme?)

    So basically I want the functionality and back-end appearance to be totally gone..

    It helps, but it’s not entirely what I wanted…

    I need the entire custom header functionality removed from twenty ten using the functions.php from my child theme. (So, I need the page etc. removed from the back-end as well.) Can somebody help me some more please?

    Does somebody already have an answer to this question? How to simply remove all custom header functionality in twenty ten with the help of the functions file in a child theme?

Viewing 10 replies - 1 through 10 (of 10 total)