WordPress.org

Forums

Origami
[resolved] Custom code in header does work. (6 posts)

  1. bbloqx
    Member
    Posted 2 years ago #

    Hey Greg, it me again.

    Could you explain why custom code in header.php does work with Origami theme but does with other themes?

    For example, if I add the following to the header.php it does display the tree structure as it should.

    <link rel="stylesheet" href="/css/tree/jquery.treeview.css" />
    <script src="/js/tree/jquery.js" type="text/javascript"></script>
    <script src="/js/tree/jquery.cookie.js" type="text/javascript"></script>
    <script src="/js/tree/jquery.treeview.js" type="text/javascript"></script>
    <script type="text/javascript">
             $(function() {
                     $("#tree").treeview({
                            collapsed: true,
                            animated: "medium",
                            control:"#sidetreecontrol",
                            persist: "location"
                     });
             })
    </script>
  2. bbloqx
    Member
    Posted 2 years ago #

    Sorry I meant to say "doesnt work" and "doesnt display", oooops.

    Here is a sample of the beginning part of the code in the post:

    <div id="sidetree">
    <div class="tree header">
    <div id="sidetreecontrol"><a href="?#">Collapse All</a> | <a href="?#">Expand All</a>
    <ul id="tree">
    	<li><a name="A"><strong>A</strong></a>
  3. bbloqx
    Member
    Posted 2 years ago #

    Hello Greg,

    Origami has passed 95% of our needed functionality but I'm at a stand still now.

    I cannot seem to figure out why the above javascript doesnt work with Origami. I have tested it with other themes and it works fine.

    In a nutshell, I have an "index" file with a couple thousand lines of code that I append to certain posts (not all but the one's in the "Index" category). Rather than add the 2000 lines to each post, we use "WP File-Tree" shortcode to add it to the relevant posts. The unordered list appears fine at the bottom of each post but the javascript to turn it into a tree structure does not.

    For example the following unordered list does appear but again not in a tree structure.

    <div id="sidetree">
    <div class="tree header">
    <div id="sidetreecontrol"><a href="?#">Collapse All</a> | <a href="?#">Expand All</a>
    <ul id="tree">
    	<li><a name="A"><strong>A</strong></a>
    		<ul>
    		<li>Actions,
    			<ul>
    			<li><a href="/beholding/">beholding</a>,</li>
    			<li><a href="/closeness/">closeness</a>,</li>
    			<li><a href="/concern/">concern of</a>,</li>
    			<li><a href="/fear/">fear of</a>,</li>
    			<li><a href="/hope/">hope in</a>,</li>
    			<li><a href="/love/">love of</a>,
    				<ul>
    				<li><a href="/true-love/">true-love</a>,</li>
    				</ul>
    			</li>
    			<li><a href="/pleasure/">pleasure</a>,</li>
    			<li><a href="/pride/">pride in</a>,</li>
    			</ul>
    		</li>
    		<li>Appetite,
    			<ul>
    			<li><a href="/losing/">losings one's</a>,</li>
    				<ul>
    				<li><a href="/to lose weigh">to lose weigh</a>,</li>
    				</ul>
    			</li>
    			<li><a href="/what-is-appetite">what is</a>,</li>
    			</ul>
    		</li>
    		<li>Apples, (See <a href="#fruits">Fruits</a>)</li>
    		</ul>
    	</li>
    </ul>
    </div>
    </div>
    </div>

    Do you have any idea why this is? Or how we can resolve this problem?

    Thanks

  4. bbloqx
    Member
    Posted 2 years ago #

    After tweaking with the css file and the placement of the javascript in the header, it NOW works :)

  5. Greg Priday
    Member
    Theme Author

    Posted 2 years ago #

    Hey BB

    Glad you got it working. Just saw this thread now.

    In general, I usually suggest using a plugin rather than editing theme files directly. I'm not 100% sure, but this might work for you

    http://wordpress.org/plugins/css-javascript-toolbox/

    It lets you add custom CSS and JS to your headers, without hacking files.

  6. bbloqx
    Member
    Posted 2 years ago #

    Hello Greg

    Thanks for the reply and the suggested plugin. I'm trying to minimize the number of plugins to those we really need (not just like :)

    I ended up created a child theme and I am modifying certain files within the child directory.

    I do have a short list of suggestions (which I think would make the theme even better) if your interested I will draft up some of my humble thoughts :)

    I will update you with our url once we finish tweaking the look and feel.

    Thanks
    Admin BBloqx com

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.