ﺔﻴﻓﺎﺿﻹﺍ ﺕﺎﻧﻮﻜﻤﻟﺍﻭ ﻉﻮﺿﻮﻤﻠﻟ ﺓﺮﺼﺘﺨﻤﻟﺍ ﺯﻮﻣﺮﻟﺍ ﺽﺭﺎﻌﺗ ﺐﻨﺠﺗ ﺔﻴﻔﻴﻛ
؟ءﺎﻄﺧﺃ ﻪﺑ ﻉﻮﺿﻮﻤﻟﺍ ﻭﺃ ﺪﻋﺎﺴﻤﻟﺍ ﺞﻣﺎﻧﺮﺒﻟﺍ ﻞﻫ ؟ﻚﻟﺫ ﻲﻓ ﺍﺫﺎﻣﻭ .ﻕﻼﻃﻹﺍ ﻰﻠﻋ ﻞﻤﻌﻳ ﻻ ﺎﻌًﻣ ﻲ
.ءﻲﺷ ﺮﻬﻈﻳ ﻻ ،ﻚﻟﺬﺑ ﻡﺎﻴﻘﻟﺍ ﺪﻨﻋ ﻦﻜﻟﻭ .[testimonials] ﻲﻟﺎﺘﻟﺍ ﺮﻴﺼﻘ
.ﻂﺒﻀﻟﺎﺑ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﺲﻔﻧ ﻥﺍﺩﺪﺤﻳ ﻲﻓﺎﺿﻹﺍ ﻥﻮﻜﻤﻟﺍﻭ ﻚﺑ ﺹﺎﺨﻟﺍ ﺐﻟﺎﻘﻟﺍ ﻥﺃ ﻮﻫ ،ﺕﺍﺩﺎﻬﺸﻟﺎ
.ﺔﻟﺎﺤﻟﺍ ﻩﺬﻫ ﻲﻓ ﻞﻣﺎﻛ ﻞﻜﺸﺑ ﺭﺎﺒﺘﻋﻻﺍ ﻲﻓ ﺎﻫﺬﺧﺃ ﻢﺘﻳ ﻻﻭ ﺎﻬﻟﺍﺪﺒﺘﺳﺍ ﻢﺘﻳ ،ﺕﺎﻤﺴﻟﺍ ﺕﺎﻔﻠﻣ ﻞ
.ﻲﻓﺎﺿﻹﺍ ﺰﻣﺮﻟﺎﺑ ﻪﻟﺍﺪﺒﺘﺳﺍﻭ ﻉﻮﺿﻮﻤﻠﻟ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﻞﻴﺠﺴﺗ ءﺎﻐﻟﻹ ﺔﻄﻴﺴﺑ ﺔﻘﻳﺮﻃ ﻚﻟ ﺽﺮﻋﺃ
ﻂﻴﺴﺑ ﻲﻓﺎﺿﺇ ﻥﻮﻜﻣ ءﺎﺸﻧﺇ :1 ﺓﻮﻄﺨﻟﺍ
:ﻂﻴﺴﺑ ﻲﻓﺎﺿﺇ ﻥﻮﻜﻣ ءﺎﺸﻧﺇ ﻰﻟﺇ ﺝﺎﺘﺤﻧ
<?php
/*
Plugin Name: Avoid Shortcodes conflicts
Plugin URL: http://remicorson.com
Description: A little plugin to avoid conflicts bewteen shortcodes
Version: 1.0
Author: Remi Corson
Author URI: http://remicorson.com
Contributors: corsonr
Text Domain: rc_asc
Domain Path: languages
*/
ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﺩﻮﺟﻭ ﻦﻣ ﻖﻘﺤﺘﻟﺍ :2 ﺓﻮﻄﺨﻟﺍ
.ﻪﻨﻣ ﺍءًﺰﺟ ﻪﻨﻋ ﺚﺤﺒﻧ ﻱﺬﻟﺍ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﻥﺎﻛ ﺍﺫﺇ ﺎﻤﻣ ﻖﻘﺤﺘﻟﺍﻭ ﺮﻴﻐﺘﻤﻟﺍ ﺍﺬﻫ ﺔﻌﺟﺍﺮﻣ ﻰﻟ
/**
* Check if a shortcode is already registered
*
* @since 1.0
*
* @param $shortcode string The shortcode slug to test
*
* @return void
*/
function rc_asc_shortcode_exists( $shortcode = false ) {
global $shortcode_tags;
//echo '<pre>'; var_dump($shortcode_tags); echo '</pre>';
if ( ! $shortcode )
return false;
if ( array_key_exists( $shortcode, $shortcode_tags ) )
return true;
return false;
}
.ﻩﺩﻮﺟﻭ ﻡﺪﻋ ﺔﻟﺎﺣ ﻲﻓ FALSE ﻭﺃ ،ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﺩﻮﺟﻭ ﺔﻟﺎﺣ ﻲﻓ TRUE ﺔﻟﺍﺪﻟﺍ ﻩﺬﻫ ﻊﺟﺮﺗُ .ﻪ
ﺪﻳﺪﺠﻟﺍ ﺰﻣﺮﻟﺍ ﻞﻴﺠﺴﺗﻭ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﺔﻟﺍﺯﺇ :3 ﺓﻮﻄﺨﻟﺍ
.ﻞﻌﻔﻟﺎﺑ ﻼًﺠﺴﻣ ﻦﻜﻳ ﻢﻟ ﺍﺫﺇ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﻒﻴﻀﻳ ﻭﺃ ،ﺍﺩًﻮﺟﻮﻣ ﻥﺎﻛ ﺍﺫﺇ ﻪﻟﺪﺒﺘﺴﻳ ﻭﺃ ،ﺮﻴﺼﻘﻟ
/**
* Check if a shortcode is already registered and replace it
*
* @since 1.0
*
* @return void
*/
function rc_asc_replace_shortcode() {
$shortcode = 'testimonials';
if( rc_asc_shortcode_exists( $shortcode ) ) {
remove_shortcode( $shortcode );
add_shortcode( $shortcode, 'my_testimonials_function' );
} else {
add_shortcode( $shortcode, 'my_testimonials_function' );
}
}
ﺓﺪﻳﺪﺠﻟﺍ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﺔﻔﻴﻇﻭ ﺪﻳﺪﺤﺗ :4 ﺓﻮﻄﺨﻟﺍ
!ﺖﻴﻬﺘﻧﺍ ﺪﻗ ﻥﻮﻜﺗ ﻚﻟﺬﺑﻭ ،"()my_testimonials_shortcode" ﺔﻔﻴﻇﻭ ﻯﻮﺘﺤﻣ ﺪﻳﺪﺤﺗ ﻮﻫ ﻪﻠﻌﻓ
/**
* Creates the new shortcode
*
* @since 1.0
*
* @return void
*/
function my_testimonials_function() {
return 'this replaces the previous shortcode!';
}
.ﺢﻴﺤﺼﻟﺍ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺎﺑ ﺎﻘًﺒﺴﻣ ﻦﻠﻌﻤﻟﺍ ﺮﻴﺼﻘﻟﺍ ﺰﻣﺮﻟﺍ ﻝﺍﺪﺒﺘﺳﺍ ﻥﻵﺍ ﻢﺗ ،ﻥﻭﺮﺗ ﺎﻤﻛ