Forum Replies Created

Viewing 15 replies - 61 through 75 (of 78 total)
  • Thread Starter studiokb

    (@studiokb)

    Hey that works. Thanks for the quick response & fix.
    Will I just update as normal next time?
    Thanks

    • This reply was modified 9 years, 2 months ago by studiokb.
    Thread Starter studiokb

    (@studiokb)

    Yeah that worked fine. Fairly easy to restructure each individual testimonial layout.
    Thanks

    Thread Starter studiokb

    (@studiokb)

    Ok Thanks Hal, I’ll try copying that file.

    Thread Starter studiokb

    (@studiokb)

    Hey,
    I got it to work.
    I had to target the post__not_in part of the query and make sure the input was an array. Also, I never notice before but the exit; was obviously just exiting the function so the rest of my page was not loading. This my code now:

    function filter_query(  $query ) {
        $exclude_ids =  "212";
    	echo '<pre>';
    		print_r($query);
    	echo '</pre>';
        $query['post__not_in'] = array(212, 214);
        echo '<pre>';
    		print_r($query);
    	echo '</pre>';
    
    	return $query;
    }
    add_filter('wpc_query', 'filter_query', 1 );

    I was still getting the warning, but by removing the $param arguments that was prevented.
    Now I just need to dynamically get the page id into my variable. Should be easy…
    Thanks for your help.

    PS. for anyone else, remove the echo and print statements from above.

    Thread Starter studiokb

    (@studiokb)

    Hi,

    I’m actually putting the code in a custom-post-type single page (trying to exclude the post I’m on from showing in carousel). But i’ve tried in the functions file and get the same warning here Warning: Missing argument 2 for get_query() in and it references the first line where the function is declared.

    Think we’re getting closer though, printing out the query array helps. My code now is :

    function get_query(  $query, $params ) {
        $exclude_ids =  214;
    	echo '<pre>';
    		print_r($query);
    	echo '</pre>';
        $query['post__not_in'] = $exclude_ids;
        echo '<pre>';
    		print_r($query);
    	echo '</pre>';
    	exit;
    
    	return $query;
    }
    add_filter('wpc_query', 'get_query', 1, 2);

    And I get printed out on the page:

    Array
    (
        [post_type] => Array
            (
                [0] => head-office-team
            )
    
        [post_status] => publish
        [posts_per_page] => 8
        [no_found_rows] => 1
        [post__not_in] => Array
            (
                [0] =>
            )
    
        [orderby] => ID
        [order] => asc
    )
    Array
    (
        [post_type] => Array
            (
                [0] => head-office-team
            )
    
        [post_status] => publish
        [posts_per_page] => 8
        [no_found_rows] => 1
        [post__not_in] => 214
        [orderby] => ID
        [order] => asc
    )

    Head-office-team is the custom post type and I’ve printed the query twice to see if I was assigning the value correctly. It looks to be assigned to post__not_in (in second print out) but the warning Missing argument 2 for get_query() shows and the carousel doesn’t load, nor does the rest of the page.
    Do I need to do something with $params?

    Thread Starter studiokb

    (@studiokb)

    Hi,
    Thanks. I still get the error – Missing argument 2 for ri_wpc_exclude_current()

    with:

    function ri_wpc_exclude_current( $query_args, $params ) {
        $exclude_ids = array( 214 );//
        $query_args['post__not_in'] = $exclude_ids;
    }
    add_filter('wpc_query', 'ri_wpc_exclude_current', 1, 1);

    I’m not hugely familiar with filtering an already existing wpQuery.

    Thread Starter studiokb

    (@studiokb)

    Hi,
    I wonder could you help with this code to exclude an ID. I’m just trying it by setting my exclude ID to the post ID I want to exclude, 214 in this case.
    This is what i have been trying, there’s another attempt commented out:

    function ri_wpc_exclude_current( $query_args, $params ) {
        $exclude_ids = array( 214 );// 
    
        $query_args['post__not_in'] = $exclude_ids;
        //$query_args['post_not_in'] = explode(',', $params['214']);
    }
    add_filter('wpc_query', 'ri_wpc_exclude_current', 1, 2);

    But I get a warning
    Warning: Missing argument 2 for ri_wpc_exclude_current()

    I tried removing $params from the ri_wpc_exclude_current parameters but that doesn’t work.

    Thread Starter studiokb

    (@studiokb)

    Oh I see you have a filter on the query – wpc_query (2 parameters – $value, $params) *
    Maybe I can use this to get what I want? I would maybe need to create a variable with current post ID and drop it into this filter?
    Would that work?

    Thread Starter studiokb

    (@studiokb)

    Cool, Thanks.

    Thread Starter studiokb

    (@studiokb)

    Slight correction: it appears after the body tag in the dev tools but on viewing source it is in the head tag after meta tags as below-

    <meta name=”viewport” content=”width=device-width, initial-scale=1″ />
    checked=’checked'<link rel=”alternate” type=”application/rss+xml”

    Thread Starter studiokb

    (@studiokb)

    Hi,

    I tried that change but still the same.
    I’ll email you direct the url.

    Thread Starter studiokb

    (@studiokb)

    Hi,
    Thanks for the quick response.
    I did upload the image through the plugin’s upload button. I tried 2 jpgs and a png.
    I also tried it by uploading through the media area first but the same warning.
    I am using the latest version of the plugin v2.7.

    The warning in my first post was the only warning received.
    Some quick research about that php function suggest using relative path like /public_html/wp-content/uploads/2015/10/logo-login.png instead of absolute url like http://www.mydomain.com/wp-content/uploads/2015/10/logo-login.png

    Thread Starter studiokb

    (@studiokb)

    After some work, I figured a way to do this:
    To allow Other user eg Editor/New Role access Wordfence ‘Remove from Wordfence cache’.
    Capability must be set to allow Manage Options and to allow Activate plugins.
    This gives access to Plugin menu, however you can restrict this by disallowing access from the Admin Menu.
    You can then Disallow access to the Wordfence menu also without disabling the ‘Remove from Wordfence cache’ capability.
    Manage Options also gives access to a lot of other options so check what else has been given access to.
    You can also remove the Wordfence Activity from the dashboard by going to Metabox and Widget, Refresh the list and then remove it from Dashboard here.
    You can then remove access to all un-needed menu items for that role.

    Just in case anyone else was wondering…

    studiokb

    (@studiokb)

    Hi,
    I would agree to this request to allow different User Roles use the ‘Remove from Wordfence cache’. I am trying to allow my editor access to do this but cannot find a way, even though I am using Advanced Access Manager, but Wordfence does not show up either in Admin Menu access or Capabilities list.
    Is there even a way to do this with some code in the functions.php?

    Otherwise, wordfence is great.

    Yes, in a child theme is the best option provided you’re using one.
    If your theme has an options page (Theme name often appears in admin menu) there may be a field to add custom css.
    If not using child theme, then worse case scenario (because it could be overwritten in a theme update) is to put it at the bottom of your theme css file. This can be done in the admin area, got to Appearance > Editor and make sure you have selected the style.css file.

    Still surprised the author hasn’t fixed this to not use the !important rule.

Viewing 15 replies - 61 through 75 (of 78 total)