WordPress.org

Forums

Using wordpress in other files. (7 posts)

  1. jpkript
    Member
    Posted 5 years ago #

    Hello,

    im trying to use wordpress as my news engine, and it is not working.
    i edited its template, to fit my page, but when im including wordpressindex.php in my webpage it throws me error:
    "Fatal error: Call to undefined method stdClass::set_prefix() in D:\xampp new\htdocs\reloud\test\wp-settings.php on line 287"

    That function have nothing to do with that, i can fix only tha tfuction, but when it includes nothing, even without error, blank window...

    example of my webpage.

    main page
    index.php context:
    <?php require "main.php"; page(); ?>

    main.php context:
    <?php function page() { /* echo bla bla bla */ require "wordpressindex.php"; /* echo bla bla bla */ } ?>

    aand its not working.

    P.S. without including anything, just executing wordpressindex.php its working, ex: via firefox...

  2. Samuel B
    moderator
    Posted 5 years ago #

  3. ClaytonJames
    Member
    Posted 5 years ago #

    Assuming of course that you may not have seen this yet, is there anything here that might push you in the right direction?

    http://codex.wordpress.org/Integrating_WordPress_with_Your_Website

  4. jpkript
    Member
    Posted 5 years ago #

    yes, thanks, that did help'd.

    I still have one question, i wonder can you guys help me.

    this script gives me 5 posts.

    <?php query_posts('showposts=5'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <h1>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h1>
    <?php the_content('Skaityti pilną tekstą'); ?>
    <p class="author">Parašė: <?php the_author() ?></p>
    <p class="comms">Komentarų: <?php comments_popup_link('0', '1', '%'); ?></p>
    <?php endwhile; ?>

    <?php else : ?>
    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php get_search_form(); ?>
    <?php endif; ?>

    Can i get those posts only from that category, what i want ? thats only one thing left to do, since im new with wordpress, i dont know its structure, how it works. Maybe to someone who works with it will be faster to give me a sample.

  5. Rev. Voodoo
    Volunteer Moderator
    Posted 5 years ago #

    http://codex.wordpress.org/User:JamesVL/query_posts#Category_Parameters

    I found this in the codex....I'm not a programmer, so I'm not sure quite how to join the two things
    query_posts('cat=1');

    with

    <?php query_posts('showposts=5'); ?>

    if someone can show you the formatting, or you can find an example of how to join these two things, you'll be set!

    edit... I think its like:
    <?php query_posts('cat=1&showposts=5'); ?>

    (obviously switch out the cat for the approprioate cat ID)

  6. jpkript
    Member
    Posted 5 years ago #

    ok that is good, ok. wordpress is very undfriendly for codders...

    Now i have problems with comments, since i dont use usual url style. I dont know how to integrate post comments... if i find a right code, jus dont know how to give him post id, from which comments it should show, and to which users should write comments...

  7. jpkript
    Member
    Posted 5 years ago #

    So please help someone. Thats only thing, which left.

    how do i integrate comments, where to give it post id in code ?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags