djdavedawson
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: pre_get_posts exclude widgets queryOk I got it, had to set it up with brackets like this
$query->query_vars['post_type']
Thanks again BC !!
Forum: Developing with WordPress
In reply to: wp_get_attachment_image_src filter size nameAwesome, Everything worked after putting in the right sequence.
Thank you very much !!
- This reply was modified 6 years, 4 months ago by djdavedawson.
Forum: Developing with WordPress
In reply to: wp_get_attachment_image_src filter size nameThanks BC,
Can you show me how to implement the -> remove_filter() in this manner.
Thanks Again
Forum: Developing with WordPress
In reply to: wp_get_attachment_image_src filter size nameRead through, thought I had it with this one, still missing something.
function listing_page_thumbnail( $image, $attachment_id, $size, $icon ) { if ( $size === 'big_size' ) { $image = wp_get_attachment_image_src($attachment_id, 'list_size'); } return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon ); }
Forum: Developing with WordPress
In reply to: pre_get_posts exclude widgets queryOk, so I did a var dump and got the team page specified -> object(WP_Query)#1503 and the widget specified -> object(WP_Query)#2502. Not sure if those are the values im looking for. I know the post types, they show in the dump also.
Forum: Developing with WordPress
In reply to: Get post image directory urlThis did not work ??
dirname( $filename )
I have uploaded a vCard file to the media library for each individual post.
I have a custom field where I put the file name in but need the full path to the vCard. Since the image path corresponds to publish date.
Like this -> “uploads/2018/09/image_name.jpg”
I have since made something that works ok
$vcard = get_post_meta($post->ID, “vcard”, true);
$url = explode(‘/’, get_the_post_thumbnail_url($post->ID)); array_pop($url); $vcardpath = implode(‘/’, $url) . “/”. $vcard;But there has to be something more elegant ??
- This reply was modified 6 years, 4 months ago by djdavedawson.
Forum: Developing with WordPress
In reply to: pre_get_posts exclude widgets queryI tried using this condition is_post_type(‘team’) like this to isolate the query that needs changed:
function team_pagesize( $query ) { if (is_page_template('team_list.php') && is_post_type('team') ) { $query->set( 'posts_per_page', 50 ); $query->set( 'order', 'ASC' ); return; } } add_action( 'pre_get_posts', 'team_pagesize', 1 );
and adding this below:
function is_post_type($type){ global $wp_query; if($type == get_post_type($wp_query->post->ID)) return true; return false; }
But it won’t recognize the post type from the $args on the page template.
Forum: Developing with WordPress
In reply to: pre_get_posts exclude widgets querySteven,
Sorry for the confusion. Actually it appears that the widget in question is a custom one that came with the theme. This widget calls the query like this ->
$the_query = new WP_Query( $args );
Which is the same way the page template does. Although the $args are different and call different post types. I can seem to use the post type to write a conditional statement.
Forum: Developing with WordPress
In reply to: Overriding size argument in functions.phpThanks Steven, I got it going now, I had the filter set for post_thumbnail_html and not post_thumbnail_size.
Thanks Again
- This reply was modified 6 years, 5 months ago by djdavedawson.
Forum: Developing with WordPress
In reply to: Overriding size argument in functions.phpOk, I got it working, question, in the img srcset it shows all the sizes available. Is this typical?
Forum: Developing with WordPress
In reply to: Overriding size argument in functions.phpThanks for the quick reply, Still having a bit of trouble using this hook in the functions.php file. Is there another link that may show a bit more.
Thx again ??
Forum: Installing WordPress
In reply to: Disable mod securityHere’s an update … I posted too many zeros in the one above.
Here is what you need:
<LocationMatch “/wp-admin/post.php”>
SecRuleRemoveById 300015 300016 300017
</LocationMatch><LocationMatch “/wp-admin/admin-ajax.php”>
SecRuleRemoveById 300015 300016 300017
</LocationMatch><LocationMatch “/wp-admin/page.php”>
SecRuleRemoveById 300015 300016 300017
</LocationMatch>Forum: Installing WordPress
In reply to: Disable mod securityIt turns out I have mod_security 2 and ms2 does not support .htaccess overrides.
More on that here:
https://www.drak.net/news/2009/01/05/mod-security-override-no-longer-works/
So I had to edit my whitelist.conf here:
/usr/local/apache/conf/modsec2/whitelist.conf
and I added
<LocationMatch “/wp-admin/post.php”>
SecRuleRemoveById 300015 3000016 3000017
</LocationMatch><LocationMatch “/wp-admin/admin-ajax.php”>
SecRuleRemoveById 300015 3000016 3000017
</LocationMatch><LocationMatch “/wp-admin/page.php”>
SecRuleRemoveById 300015 300016 300017
</LocationMatch>Now it works like I need it to.
Hope that helps for someone
Forum: Installing WordPress
In reply to: Disable mod securityI tried in both and I am still getting 500 errors.
Do I need to change anything in mod_security to allow these commands to work?
Forum: Installing WordPress
In reply to: Disable mod securityDoes this go in the root .htaccess or in the wp-admin ?