Forum Replies Created

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

    (@davideno)

    Sleep has clarified my thoughts. For each WordPress page a number of database queries are generated to populate main content, widgets, etc., etc. The key to my particular problem is to know what queries are being generated and how to identify and address them individually. Then I will be able to target my functions, which seem to work now, to particular circumstances.

    Thank you for your help and patience.

    Thread Starter davideno

    (@davideno)

    Further to above I now have this working. The complication is there are two similar functions which need to be targeting separate querys.

    //ORDER BLOG POSTS BY SPECIAL SORT

    add_filter(‘posts_orderby’, ‘seasonal_posts_orderby’);

    function seasonal_posts_orderby($sortorder) {
    //target all pages apart from glossary page main query
    $sortorder = “CASE WHEN DAYOFYEAR(post_date) < DAYOFYEAR(NOW())-18 THEN 1 ELSE 0 END , DAYOFYEAR(post_date) “;
    return $sortorder;

    }

    //ORDER PROJECTS BY TITLE

    add_filter(‘posts_orderby’, ‘glossary_orderby’);

    function glossary_orderby($sortorder) {
    // target the glossary page main query
    if (get_the_ID() !=1523) return;

    $sortorder = “post_title”;
    return $sortorder;
    }

    It’s fine if the first filter targets all queries, apart from the glossary main query. The second function must

      only

    target the glossary main query. I guess the could both be combined.

    Thread Starter davideno

    (@davideno)

    Justin

    I tried your suggested addition to the code and it is indeed the main query I need to change. I added a break point before

    `$query->set( ‘orderby’, ‘title’ );
    $query->set( ‘order’, ‘ASC’ );`

    and it is reaching this point.

    I dumped $query and ‘orderby’ is being set as ‘title’, but not having any effect.

    bcworkz

    I guess the above probably proves the point you are making, but I’m a little out of my depth in following your suggestion.

    I am using the theme ‘Extra’ (Divi) and have set up the main Glossary page how I want it using their Blog module selecting ‘projects’ as the Post Type. I’m not sure if this has a bearing on what you are suggesting? Everything is perfect apart from the Order.

    You helped me with another ORDER problem on my main page recently where a filter was the answer:

    add_filter('posts_orderby', 'seasonal_posts_orderby');
    
    function seasonal_posts_orderby($sortorder) {
       
        $sortorder = "CASE WHEN DAYOFYEAR(post_date) < DAYOFYEAR(NOW())-18 THEN 1 ELSE 0 END , DAYOFYEAR(post_date) ";
        return $sortorder;   
    }

    Should I try to adapt this? I had a quick try but it didn’t seem to work.

    Thank you both for your help

    Thread Starter davideno

    (@davideno)

    Thanks very much for the help, this solved my problem completely.

    Thread Starter davideno

    (@davideno)

    Hi Dima

    That will be fantastic!

    Thanks very much

    David

    Thread Starter davideno

    (@davideno)

    Hello Oleg
    Thanks very much for your quick reply, but is there a way to make all these shortcodes respond to the featured brand, instead of specifying an id? This would mean the client wouldn’t have to get into any code in multiple places but instead could just tick the checkbox in the brand details?

    EG something like:
    [brands_info featured_brand=1 type=”name”]
    [brands_info featured_brand=1 type=”image”]
    [brands_info featured_brand=1 type=”description”]
    [products featured_brand=1]

    Thanks
    Regards
    David

    Hi,

    I’m having exactly the same problem – see attached screenshot. The post ‘DYNNARGH DHIS (WELCOME)’ should appear at the top of the white area, not in the black heading area and there should be a whole paragraph of text under the heading.

    It’s a brand new site with a brand new install of WordPress 3.8.1 – 2 plugins – deactivated. Different browsers all display the same problem.

    https://drive.google.com/file/d/0B7p34btu5gMtTmdTb0pMMkNKdGs/edit?usp=sharing

    Thanks for any help.

    Hi Tobias

    Many thanks for your clear and helpful answers which have fixed all the problems!

    Best wishes

    David

    Hi Tobias

    I have a couple of problems with TablePress.

    1. On the preview my columns are left justified, which is what I want, but when inserted into the page the right hand column is right justified which I don’t want.

    2. I’ve unchecked the box for alternate line colouring, but this seems to have no effect. I’d prefer just a white background or a uniformly shaded background.

    3. Something odd is happening with rules above an below each line ie they are broken. I may not want lines at all – I can’t tell until I see it without alternate shading.

    I’m using latest versions of WordPress and TablePress and theme iFeature Pro4

    see: http://lewannick.cornwall.sch.uk/?page_id=55

    Any help would be welcome

    Thanks

    David

    Thread Starter davideno

    (@davideno)

    Hi

    I don’t think any plugins have been updated or added. However, I just found there is also a problem uploading directly to the Media Library which I believe is a permissions issue. This gives a different error but it may be connected. I’m just having someone look at this on the server. Will update as soon as I hear about this.

    Thanks

    David

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