WordPress replace content of a page (plugin) -


I am writing a plugin that adds a page with the tag [deposit_page]; That tag should be replaced with some PHP code.

I have it, but it does not work. Am I missing something or wrong?

function_p_p_p_p_p_p_p_p_p_page_set ($ content) {$ deposit_page_content = "here will be content that should be replaced by tags"; // variable_acc_page_content end $ content = str_ireplace ('[deposit_page]', $ deposit_page_content, $ content); Return $ content; } Add_filter ("the_content", "deposit_page_content");

I just saw that I have given the same name as the variable name that should be replaced by the tag and the function. Can this be the problem?

There is support for [square_bracket_shortcodes] in WordPress

< P> View:

This is your simple example:

  function deposit_page_shortcode ($ atts) {$ deposit_page_content = "Content must be changed here," tags should be changed "; Return $ deposit_page_content;} Add_shortcode ('plus_page', 'plus_pages_shortcode');  

You can set your active theme functions.php

If you want the attributes, like [my_shortcode foo = bar] , you want to At the top of this function:

  extract (shortcode_atts (array ('foo' = & gt; 'default fu', 'example' => 'default example',), $ Atts)); // Now you can reach $ foo and $ example  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -