get_permalink()
只是没有切断它。这是我最后要做的,以防有一天有人尝试做同样的事情。。。
// Thank you Stack Exchange, Themify & Tuts+ (a little piece of each of you is in here).
function managercontacts_post_lists_sc( $atts, $content = null, $tag ) {
$current_page = sanitize_post( $GLOBALS[\'wp_the_query\']->get_queried_object() );
$slug = $current_page->post_name;
extract( shortcode_atts( array(
\'type\' => \'contact\',
\'orderby\' => \'menu_order\',
\'order\' => \'asc\',
\'style\' => \'list-post\',
\'logic\' => \'and\'
), $atts ) );
$args = \'\';
switch( $tag ) {
case "bearings":
$args = \'ptb_tax_vertical="bearings-sealing-products-power-transmission"\';
break;
case "conveyor_belt":
$args = \'ptb_tax_vertical="conveyor-belt-hose-rigging-hydraulics-service"\';
break;
case "electrical":
$args = \'ptb_tax_vertical="electrical-products"\';
break;
case "engineered_products":
$args = \'ptb_tax_vertical="engineered-products-services"\';
break;
case "not_specified":
$args = \'ptb_tax_vertical="not-specified"\';
break;
case "specialty_valves":
$args = \'ptb_tax_vertical="specialty-valves-actuators-instrumentation-service"\';
break;
case "welding":
$args = \'ptb_tax_vertical="welding-products-services"\';
break;
}
return do_shortcode(\'[ptb type="\'.$type.\'" orderby="\'.$orderby.\'" order="\'.$order.\'" style="\'.$style.\'" logic="\'.$logic.\'" \'.$args.\' ptb_tax_manager="\'.$slug.\'"]\');
wp_reset_query();
}
add_shortcode( \'bearings\', \'managercontacts_post_lists_sc\' );
add_shortcode( \'conveyor_belt\', \'managercontacts_post_lists_sc\' );
add_shortcode( \'electrical\', \'managercontacts_post_lists_sc\' );
add_shortcode( \'engineered_products\', \'managercontacts_post_lists_sc\' );
add_shortcode( \'not_specified\', \'managercontacts_lists_sc\' );
add_shortcode( \'specialty_valves\', \'managercontacts_post_lists_sc\' );
add_shortcode( \'welding\', \'managercontacts_post_lists_sc\' );
谢谢所有插话的人!