WordPress.org

Ready to get started?Download WordPress

Forums

XHTML mobile website - add wordpress content (14 posts)

  1. iluvwrdpress
    Member
    Posted 3 years ago #

    Hi..

    I'm creating a simple xhtml mobile version of my wordpress site. Is there anyway to pull content dynamically from wordpress into the xhtml pages?

    Thanks!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Not.html pages but you could pull them into .php pages. See Integrating_Wordpress_with_Your_Website.

  3. iluvwrdpress
    Member
    Posted 3 years ago #

    but if it's a mobile site, can you use php? I thought you had to have xhtml?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    You can use PHP. It can generate XHTML.

  5. iluvwrdpress
    Member
    Posted 3 years ago #

    do you have any examples you can point me to as a starting places so I can begin developing?

    thanks!!

  6. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    The page at the link I pointed to above should help. Or you could use something like Carrington Mobile.

  7. iluvwrdpress
    Member
    Posted 3 years ago #

    can you edit the carringon mobile plugin to take off search boxes, etc...? I don't have blog posts on my site, can i remove that from the template?

  8. iluvwrdpress
    Member
    Posted 3 years ago #

    I have this code to generate the xhtml from php:

    <?php header("Content-type: application/vnd.wap.xhtml+xml; charset=UTF-8");?><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Sometitle</title>
    </head>
    <body>
    <h1>Hello</h1>
    <p><?php echo date('h:i A, j-M-y'); ?></p>
    </body>
    </html>

    If I want to display the text content from a page in my wordpress site, is that possible?

  9. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

  10. iluvwrdpress
    Member
    Posted 3 years ago #

    I'm looking through that link. I see the first part is to grab the header...etc...I actually don't want the header or any parts on my mobile site, I'd just like the text content from the pages. Do I still need to grab the header, etc...?

  11. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    It's not a page header that you will be grabbing - it's the call to the file that sets everything up so that you can use the Loop. You have to include one or other of the 2 suggested calls to wp-blog-header.php to get the whole thing to work.

  12. iluvwrdpress
    Member
    Posted 3 years ago #

    ok gotcha, thanks for bearing with me on this :)

    so.....
    I will use:

    <?php
    require('/the/path/to/your/wp-blog-header.php');
    ?>

    at the start of my page....now for the rest of the page for my mobile site, can i use this:

    <?php header("Content-type: application/vnd.wap.xhtml+xml; charset=UTF-8");?><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Sometitle</title>
    </head>
    <body>
    <h1>Hello</h1>
    <p><?php echo date('h:i A, j-M-y'); ?></p>
    </body>
    </html>

  13. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Almost there...

    Have a look at the example Loop on Integrating_Wordpress_with_Your_Website. Again, you need to use WP's Loop to display WP posts.

  14. iluvwrdpress
    Member
    Posted 3 years ago #

    tryng to follow...this is what I have now....a little hard for me to follow, but how to i specify the page i want the content to be pulled from?

    <?php
    require('/the/path/to/your/wp-blog-header.php');
    ?>
    <?php header("Content-type: application/vnd.wap.xhtml+xml; charset=UTF-8");?><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Sometitle</title>
    </head>
    <body>
    <h1>Hello</h1>
    <p><?php define('WP_USE_THEMES', false); get_header(); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    </p>
    </body>
    </html>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags