Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery’s .load() Function and WordPress
    primarykey
    data
    text
    <p>I'm currently migrating my HTML website into a WordPress Theme and have the following question:</p> <p>My current HTML website makes full use of jQuery's .load() function, by where I change the content of the page (via a DIV), using .load() based on my side menu options selected by the user.</p> <p>For example:</p> <p>HTML Code:</p> <pre><code>&lt;div id="sidebar"&gt; &lt;ul id="themenu" class="sf-menu sf-vertical"&gt; &lt;li&gt;&lt;a href="index.html" class="topm currentMenu nosub"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="about-us.html" class="topm nosub"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>jQuery Code:</p> <pre><code>$("#themenu li a, #subcat li a").click(function(){ var toLoadCF = $(this).attr("href")+" #contentfooter"; $('#contentfooter').fadeIn("slow",loadContent); function loadContent() { $("#contentfooter").load(toLoadCF); } return false; }); </code></pre> <p>So using this as an HTML situation, the user clicks on the "About Us" menu option, which would basically in turn load the "about-us.html" file based on a href tag for About Us.</p> <p>Now in the WordPress world, I have created a custom page template for About Us called "about-us.php" that is linked to a WP Admin dashboard page called "aboutus" (permalink), so my a href value is "url/aboutus/"</p> <p>Based on this, how can I achieve the same result in WordPress to emulate my HTML coding using jQuery .load?</p> <p>Pls be aware that I have added all the necessary info in my header.php, index.php and sidebar.php files.</p> <p>I'm just unsure how to reference the a href file, so that my about-us.php file is loaded using jQuery's .load()</p> <p>Hope someone can assist as I'm not too sure how to approach this from a WordPress perspective.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload