Get a free trial // Grow your CSS skills // Land your dream job

WordPress guru’s?

  • # January 30, 2013 at 12:19 am

    Are there any WordPress guru’s that visit here? This forum has been spectacular for css, javascript and some php questions but I am wondering how it would handle some advanced WordPress issues?

    # January 30, 2013 at 12:38 am

    @cybershot What’s your question exactly?

    # January 30, 2013 at 12:41 am

    5 hours of trying and I got nothing. I am including all posts and pages into the index.php to make a one page WordPress site. I am using pre_get_posts to include posts and pages.

    function posts_and_pages_on_home( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( ‘post_type’, array( ‘post’, ‘page’ ) );
    add_action( ‘pre_get_posts’, ‘posts_and_pages_on_home’ );

    so that gets all the posts and pages and puts them on my homepage. The problem with that is that it does not get the page templates. So I had to run a second query to get all page templates

    $args = array( ‘meta_key’ => ‘_wp_page_template’,’post_status’ => ‘publish’);
    $templates = get_pages($args);

    foreach ( $templates as $template){
    $templateName = $template->meta_value;
    $pageName = $template->post_name;
    if( $templateName != ‘default’ && $templateName !=”) { ?>

  • Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed