• I am trying not to use PHP codes in posts and pages. Is there anyway i could do that. It is alike alternative to PHP plugin like Exec PHP.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I use two plugins to allow php code via shortcode in a page or post.

    First, is ‘Executable PHP widget’ which is much like the text widget,
    And second is ‘Widgetize pages Light’ which essentially creates a new sidebar that you can place in a page or post via shortcode.

    This prevents any poster from inserting php code in my pages and running it, as the only exposure in the page is a predetermined sidebar widget shortcode.

    I hope this addresses your issue.

    Thread Starter ba127004

    (@ba127004)

    Perhaps, i should have written in clear way. What i mean was:

    Lets say i create a page called sample: The page contents php codes. Unless i use exec php plugins the page is not going to execute the php code. I do not like to install plugins or write php codes in the page from wordpress.

    <?php

    //display the things

    ?>

    Is there anyway, that i do not write php codes in sample.php, and display the result.

    Is there any solutions, perhaps writing directly to database or something?

    Thanks
    ba127004

    I guess it all depends on what you intend to display on the ‘sample’ page.

    WordPress is a nice system, but it cannot anticipate the needs of every possible user. Plugins exist to meet more specialized needs of individual users.

    Is it simple HTML or must you calculate some result and display that? Does the result change depending on who is looking at it?

    In my case, I must determine if the browser in use is FireFox version greater then 18, and display a PDF warning, or nothing at all if any other browser is used. I have a number of places on my site that need it. I write one copy of the php code, and reference it as many times as I need by placing a shortcode in my page that looks like this:

    [otw_is sidebar=otw-sidebar-1]

    Can you share a link so we can see more of what you have in mind?

    Thread Starter ba127004

    (@ba127004)

    Thanks for taking time to reply me.

    Lets say i created a page called customer with the following code (http://www.raima.com/customers/)

    <div class=”block_customers”>
    <?php //Create a new instance
    $second_query = new WP_Query(array( ‘category__and’ => array(11), ‘posts_per_page’=>-1, ‘orderby’ => ‘title’, ‘order’ => ‘DESC’));
    // The Loop
    while( $second_query->have_posts() ) : $second_query->the_post(); ?>
    <div class=”customerCategories”>
    ” title=”<?php the_title(); ?>”><? the_post_thumbnail(‘thumbnail’, array(‘class’ => “customerImages”)); ?>
    </div>
    <?php endwhile;
    wp_reset_postdata(); ?>

    </div><!–A&D–>

    I was thinking not to use code in customer page. I prefer not to use any plugin for executing the page. Lets say i do not want any coding in page, and expect result, how do i do that.

    Thanks

    Very nice page!

    I can see several ways to do this, but what you have might be the most elegant.

    First way is to simply add the individual thumbnails to a page using the ‘Add Media’ button, and link each thumbnail to it’s static page. You insert each logo in title order – but adding a new logo is painful if it’s in the middle of the page.

    Another possibility might be to use a gallery plugin. I have not used one of these, but it looks like it may be able to handle the logo display and page linking that you need.

    Neither of these require php code on the page.

    Yet one more way to do this — since that php script only needs to be run once, put it on a private page and run it – cut and paste the output to your ‘customers’ page.

    Only run the script when the customer list changes.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Alternatives to posting PHP codes in posts or pages’ is closed to new replies.