WordPress.org

Ready to get started?Download WordPress

Forums

My Simple Plugin only works when logged into WP (2 posts)

  1. FinanzProfi
    Member
    Posted 3 years ago #

    I have tried to write a very simple plugin which just gets a random financial quotation from a text file.
    Unfortunately, the plugin only displays a quote when I am logged in as a user into WordPress. Do you have any idea what I should change in order to make it work for every visitor?

    The main code in the php file is as follows:

    ===========
    function finanzzitat () {
    $file_path = "zitate.txt";
    $zitate = (ABSPATH . "wp-content/plugins/finanzzitat/" . $file_path);
    {
    $linesize = file("$zitate");
    $ein_zitat = rand(0, sizeof($linesize)-1);
    echo $linesize[$ein_zitat];
    }
    }
    ?>
    ===========

    I call the function with
    <?php finanzzitat(); ?>

    Your help is very appreciated!

  2. FinanzProfi
    Member
    Posted 3 years ago #

    * bump * ;-)

    Any ideas? It is probably only a very simple problem but I have no clue about it...

Topic Closed

This topic has been closed to new replies.

About this Topic