Categories
Apply to

How to Hide That Your Site is Using WordPress | kevinleary.net

Source: How to Hide That Your Site is Using WordPress | kevinleary.net

Categories
Apply to

Filter wordpress uploads

`

add_filter(wp_get_attachment_url, function($url) {
if (getenv(USE_S3_UPLOADS)) {
$url = https:// . getenv(AWS_S3_BUCKET) . .s3.amazonaws.com . str_replace(WP_CONTENT_URL, , $url);
}
return $url;
});
add_filter(wp_calculate_image_srcset, function($sources) {
if (getenv(USE_S3_UPLOADS)) {
foreach ($sources as &$s) {
$s[url] = https:// . getenv(AWS_S3_BUCKET) . .s3.amazonaws.com . str_replace(WP_CONTENT_URL, , $s[url]);
}
}
return $sources;
});
add_filter(the_content, function($content) {
if (getenv(USE_S3_UPLOADS)) {
$content = preg_replace(
~https?\:\/\/www.site.com\/wp-content\/uploads~,
https:// . getenv(AWS_S3_BUCKET) . .s3.amazonaws.com/uploads,
$content
);
}
return $content;
}, PHP_INT_MAX);

@pbrocks

`

Source: Filter wordpress uploads

Categories
Apply to

In-Depth Look at WordPress Permalinks and URL Rewriting

URLs determine the query to be run against the database. For this reason, our first step will be a short introduction to WordPress queries.

Source: In-Depth Look at WordPress Permalinks and URL Rewriting

Categories
Apply to

custom post types – Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin? 

@tazo-todua this worked for me too when using multisite. add_action( ‘wpmu_new_blog’, ‘set_my_permalink_structure’, 11, 2 ); function set_my_permalink_structure( $blog_id ) { switch_to_blog( $blog_id ); global $wp_rewrite; $wp_rewrite->set_permalink_structure( ‘/%postname%/’ ); $wp_rewrite->flush_rules(); $wp_rewrite->init(); restore_current_blog(); }

Source: custom post types – Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin? – WordPress Development Stack Exchange

Categories
Apply to

Using WordPress public query variables

In simple words – it will tell wordpress what to query (to request a data from database). in all of cases it will try to search a posts (no mater post this or page or other post type) http://dmkim.ru/?s=uuu – eq search uuu on posts (default post type post & pages) and return a results (this is search) http://dmkim.ru/?year=2013 – eq to archive for 2013 year (for default post types) this is a dirty style (non URL/SEO friendly), usually people enable url friendly mode so wp generate a internal rewite rule

Source: Using WordPress public query variables – WordPress Development Stack Exchange

Categories
Apply to

Lock – WP Login | gist

* Verifies username and password. Redirects visitor
* to the login page with login empty status if
* either username or password is empty.

Source: lock.php

Categories
Apply to

WordPress plugin example code to correctly set a custom number of posts to display per page, for specific types of views

It’s so that other people can access the singleton object and remove its filters, without having to have yet another global variable hanging around. The code is completely encapsulated within the class.

CWS_Posts_Per_Page_Plugin::$instance->some_method()

instead of

CWS_Posts_Per_Page_Plugin::some_method()

Those two are not equivalent. The former calls a method on an object. The latter calls a method on a class. If you used the latter, PHP would throw an error when it encountered $this. This is a singleton object that has been instantiated. We want to access that object, its methods, and its properties.

Source: WordPress plugin example code to correctly set a custom number of posts to display per page, for specific types of views

Categories
Apply to

6985 Ontario Rd, Avila Beach, CA

 

Small Recreational zoned land located in the Avila Beach/Pismo Beach communities —the heart of the Central Coast tourism. Adjacent to the popular parking lot for the Bob Jones Trail, the property supports a wide range of uses for recreational/tourism purposes. Check zoning.

Source: 6985 Ontario Rd, Avila Beach, CA

Categories
Apply to

WordPress Rewrite API Examples – Daggerhart

Source: WordPress Rewrite API Examples – Daggerhart

Categories
Apply to

How to add Multiple Featured Images in WordPress – Life on Lars

The post thumbnails feature aka. Featured Image was added to WordPress back in version 2.9 and made it significantly easier for users to associate images with posts or pages. Prior to that we we had to upload an image, copy the url for the image and add that as a custom field if we wanted … Continue reading How to add Multiple Featured Images in WordPress

Source: How to add Multiple Featured Images in WordPress – Life on Lars