• hi,
    i’m new at WP Coding, i find it cool especailly with the plugin setup, so i do creat a plugin who will to easy my need to show my archives, so i creat one who used the php “str_replace”, it work perfectly whene i replace some words, but whene i put a template tag it dont
    her my code :
    ____________________
    <?php
    /*
    Plugin Name: Archives
    Plugin URI: https://agadirweb.com
    Description: Display the archives monthly or yearly.
    Version: 0.1
    Author: Hafsi Kamal
    Author URI: https://agadirweb.com
    */
    function monthly_get_archives() {
    print(‘
    <?php wp_get_archives(‘type=monthly&limit=12’); ?>
    ‘);
    }

    function my_function ($text) {
    $text = str_replace(‘###archives-monthly###’, monthly_get_archives(), $text);
    return $text;
    }
    add_filter(‘the_content’,’my_function’);
    ?>
    ____________________
    the word press declare an error in this lines with ***
    print(‘
    ***<?php wp_get_archives(‘type=monthly&limit=12’); ?>
    ‘);
    }
    thanks all for u r help

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘probleme with my plugin – str_replace’ is closed to new replies.