WordPress.org

Support

Support » How-To and Troubleshooting » XHTML mobile website – add wordpress content

XHTML mobile website – add wordpress content

  • 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!

Viewing 13 replies - 1 through 13 (of 13 total)
  • esmi

    @esmi

    Forum Moderator

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

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

    esmi

    @esmi

    Forum Moderator

    You can use PHP. It can generate XHTML.

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

    thanks!!

    esmi

    @esmi

    Forum Moderator

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

    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?

    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?

    esmi

    @esmi

    Forum Moderator

    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…?

    esmi

    @esmi

    Forum Moderator

    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.

    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>

    esmi

    @esmi

    Forum Moderator

    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.

    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>

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘XHTML mobile website – add wordpress content’ is closed to new replies.