Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling shortcodes distribution in post content #404

Open
avag-novembit opened this issue Jun 12, 2019 · 1 comment · May be fixed by #405
Open

Handling shortcodes distribution in post content #404

avag-novembit opened this issue Jun 12, 2019 · 1 comment · May be fixed by #405
Assignees
Labels
type:enhancement New feature or request.
Milestone

Comments

@avag-novembit
Copy link
Contributor

avag-novembit commented Jun 12, 2019

Is your enhancement related to a problem? Please describe.
Currently, if shortcodes in distributed post content has website specific attributes (e.g. attachment id, or gravity form id), it distributed without any additional actions, exactly as it was in original post. In this case, the attachment id in the hub website (from where the post is distributed) may not be the same as in website where distributed the post.

Describe the solution you'd like
In order to handle shortcodes distribution added functionality to provide a 'hook' for each shortcode in received post content to make possible to apply all necessary changes in shortcodes.

Designs
In the file distributor/includes/post-specific-content-handler.php function save_post_specific_content(..) (see #372):

// Handle shortcode distribution
// We need just to get all shortcodes in post content regardless their type or hierarchy
$pattern = "/\[(\[?)([^\]]+)(\]?)\]/";

$content = preg_replace_callback(
	$pattern,
	function ( $matches ) {
		$shortcode = $matches[0];

		/**
		 * Filters the the shortcode tags in the post content
		 *
		 * @param string $shortcode Whole shortcode tag including wrapped content, if there is any
		 * @param array  $matches the array of matches
		 */
		$shortcode = apply_filters( 'dt_post_content_shortcode_tags', $shortcode, $matches );

		return $shortcode;
	},
	$content
);

Going to send a PR with the mentioned functionality applied.

Thanks.

Avag

@avag-novembit avag-novembit added the type:enhancement New feature or request. label Jun 12, 2019
@avag-novembit avag-novembit linked a pull request Jun 12, 2019 that will close this issue
@jeffpaul jeffpaul added this to the 1.5.0 milestone Jun 12, 2019
@jeffpaul
Copy link
Member

@avag-novembit again, thanks for the feedback and contribution, it's greatly appreciated!

@helen helen modified the milestones: 1.5.0, 2.0.0 Jul 17, 2019
@vikrampm1 vikrampm1 moved this to Code Review in Open Source Practice Jul 3, 2024
@vikrampm1 vikrampm1 moved this from Code Review to In Progress in Open Source Practice Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants