admin管理员组文章数量:1022777
thanks to help provided by this forum, I have managed to develop a plugin that uses a database of UK towns & postcodes - using the URL parameters to build up a query & display the results. I'm at the stage now where I need to format the page - and this is where things aren't working as expected.
Lets say I click on a link for "england" - this queries the DB for all the counties / states in the UK. Extract from the Filter / plugin looks like the following:
$content = get_the_content();
$test = fs_query(get_query_var('delivery_country'));
//$content = 'Delivery location is ' . get_query_var('delivery_country');
//$content = str_replace( 'XXXXXXXXXX', fs_query(get_query_var( 'delivery_country')), $content );
//$content = str_replace( 'YYYYYYYYYY', get_query_var( 'delivery_country' ), $content );
$content .= $test;
return $content;
The function and the query work - lets say url was xyz\delivery\england then the plugin queries the DB for all counties in england. The results from the query are stored in the variable $test. What I am trying to do - as you can see from the various statements is modify the content of the page with the values in "$test".
No matter what I do, the values in $test appear first. Ideally, I want the contents of $test to appear in the middle of the page (where XXXXXXXXXX is located)?
Is there something I need to do that I am missing
Many thanks in advance....
thanks to help provided by this forum, I have managed to develop a plugin that uses a database of UK towns & postcodes - using the URL parameters to build up a query & display the results. I'm at the stage now where I need to format the page - and this is where things aren't working as expected.
Lets say I click on a link for "england" - this queries the DB for all the counties / states in the UK. Extract from the Filter / plugin looks like the following:
$content = get_the_content();
$test = fs_query(get_query_var('delivery_country'));
//$content = 'Delivery location is ' . get_query_var('delivery_country');
//$content = str_replace( 'XXXXXXXXXX', fs_query(get_query_var( 'delivery_country')), $content );
//$content = str_replace( 'YYYYYYYYYY', get_query_var( 'delivery_country' ), $content );
$content .= $test;
return $content;
The function and the query work - lets say url was xyz\delivery\england then the plugin queries the DB for all counties in england. The results from the query are stored in the variable $test. What I am trying to do - as you can see from the various statements is modify the content of the page with the values in "$test".
No matter what I do, the values in $test appear first. Ideally, I want the contents of $test to appear in the middle of the page (where XXXXXXXXXX is located)?
Is there something I need to do that I am missing
Many thanks in advance....
本文标签: pluginsUsing Filters to modify contectDB query results alwats appear fist
版权声明:本文标题:plugins - Using Filters to modify contect - DB query results alwats appear fist 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745521066a2154316.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论