This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Support Voxel custom fields in Permastructure formats | |
*/ | |
function pm_new_permastructure_tag( $custom_field_value, $custom_field, $element ) { | |
if ( empty( $custom_field_value ) && class_exists( '\Voxel\Post' ) && method_exists( '\Voxel\Post', 'get' ) && ! empty( $element->post_type ) ) { | |
$voxel_post = \Voxel\Post::get( $element ); | |
if ( method_exists( $voxel_post, 'get_field' ) ) { | |
$field = $voxel_post->get_field( $custom_field ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This little class records how long it takes each WordPress action or filter | |
* to execute which gives a good indicator of what hooks are being slow. | |
* You can then debug those hooks to see what hooked functions are causing problems. | |
* | |
* This class does NOT time the core WordPress code that is being run between hooks. | |
* You could use similar code to this that doesn't have an end processor to do that. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 1A. How to programmatically modify post permalink formats (permastructures) | |
* | |
* @param string $permastructure The permastructure string used when default custom permalink is generated. | |
* @param WP_Post|WP_Term $post Post or term object | |
* @return string The new, filtered permastructure string used when default custom permalink is generated (for new posts or existing ones if "Regenerate/reset" tool is used) | |
*/ | |
function pm_filter_post_permastructure($permastructure, $post) { | |
// Filter only 'Post' permalinks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pm_fix_googlesitekit_urls() { | |
global $permalink_manager_ignore_permalink_filters; | |
if(is_user_logged_in() && isset($_GET['permaLink']) && class_exists('Permalink_Manager_Core_Functions')) { | |
$old_url = trim(esc_url_raw($_GET['permaLink']), '/'); | |
$post = Permalink_Manager_Core_Functions::detect_post(null, $old_url, true); | |
if(!empty($post->ID)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Permalink Manager & qTranslate-XT support | |
* Plugin URI: http://maciejbis.net/ | |
* Description: Plugin that adds basic support for qTranslateXT content to Permalink Manager | |
* Version: 1.0.1 | |
* Author: Maciej Bis | |
* Author URI: http://maciejbis.net/ | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pm_replace_job_meta_tags($default_uri, $native_slug, $element, $slug, $native_uri) { | |
if(function_exists('get_job_field') && !empty($element->ID)) { | |
$fields = array( | |
'first-field', // in Permalink Manager Permastructures settings it will be '%__first-field%' | |
'second-field' // in Permalink Manager Permastructures settings it will be '%__second-field%' | |
); | |
foreach($fields as $field) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Rewrite Wordpress uploads URLs | |
* Plugin URI: https://permalinkmanager.pro?utm_source=plugin | |
* Description: Replace /wp-content/uploads/YYYY/MM/ with different directory | |
* Version: 1.0.0 | |
* Author: Maciej Bis | |
* Author URI: http://maciejbis.net/ | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |