How do I create a single WordPress page that will use PHP to include different HTML files based on a vaule in the URL?

Assuming you already set permalinks for your WordPress site, add this to your page.php: <?php include(“http://www.mysite.edu/_sports/static/”.$post->post_name.”.html); ?> $post->post_name would be the slug of your page. If you’re in a page with the slug volleyball-box-score, with the code above, you would get include(“http://www.mysite.edu/_sports/static/volleyball-box-score.html);. If you’re in a page with the slug other-page, you would get include(“http://www.mysite.edu/_sports/static/other-page.html);. … Read more

Tables not showing divs and loop/php items

In your page template line 42 you will see <?php if ( is_archive() || is_search() ) : //display excerpts for archives and search. ?> <?php the_excerpt(); ?> <?php else : ?> <?php the_content(‘Read More’); ?> <?php endif; ?> This means that there won’t be a heading on archive pages and the_excerpt doesn’t allow html like … Read more

How to reduce three query to one in multiple output template?

query for all posts at once and set a counter variable to check where you are in the loop. $products = get_posts( array( ‘numberposts’ => 7, ‘post_type’ => array(‘product’) ) ); $count = 1; foreach( $products as $product ): if( $count == 1 ): // first post elseif( $count > 1 && $count < 5 … Read more

Adding if statement to content for homepage

Check for is_front_page() and if you want to catch the first page only inspect get_query_var( ‘paged’ ) too: if ( is_front_page() and 2 > get_query_var( ‘paged’ ) ) { // we are on the first page of the front page }

doubled content

The loop in your code: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> is saying “if I have posts, display them all – by the declared # per page” So you need to modify the loop to only display the content you need. Can you provide some information on where … Read more

Submenu opened problem

Within a WordPress framework, you can do this with a combination of body_class and CSS. body_class will echo classes into the <body> tag, including a page-parent class, which you can then use to control your elements. Without seeing your actual WordPress page, I can’t give you the necessary CSS.

WordPress create new on site when a new page is added

Figured it out, there is no such thing as “dataslug”, changed it to “data-slug” and it worked perfectly. Really stupid mistake. I guess most people don’t use the tag, but if anyone wants to know you could easily replace it with a and give it a ‘scrollto’ class using the scrollto jquery plugin. Just a … Read more