Нужно получить каждый id
-
хочу получить id каждого формы, но выводит только id первого формы
add_action('wp', 'setup', 10); add_shortcode( 'form','shortcode' ); global $form; function setup() { global $post, $shortcode_tags; if ( is_object($post) ) { $tagnames = array_keys($shortcode_tags); $tagregexp = join('|', array_map('preg_quote', $tagnames)); $shortcode_regex = str_replace($tagregexp, 'form', get_shortcode_regex()); $post->post_content = preg_replace_callback("/$shortcode_regex/s", 'do_shortcode', $post->post_content); } } function shortcode($atts) { global $form; $defaults = array( 'id' => '0' ); extract( shortcode_atts( $defaults, $atts ) ); wp_parse_args($atts, $defaults); $form = $atts; } function get_form_id() { global $form; echo $form['id']; }
как получить файле шаблона плагина каждый id?
plugin/form/template/default/template.php
<div id="<?php $get_form_id; ?>"> </div>
заранее спасибо)
Просмотр 1 ответа (всего 1)
Просмотр 1 ответа (всего 1)
- Тема «Нужно получить каждый id» закрыта для новых ответов.