link to a section on the page with WP menu - html

I don't know much php but I have a parallax template and different sections which are technically pages created in wp-admin. So for example page 2 is:
<!-- Section #2 -->
<section id="middle" data-speed="4" data-type="background">
<div class="container">
<?php query_posts('page_id=' . of_get_option('home_page_2', 'no entry' )); while (have_posts()) : the_post(); ?>
<?php global $more;
$more = 0;
the_content(""); ?>
<?php endwhile; ?>
</div>
</section></a>
Now I want to modify the main wp menu at the top to link to this section. I have tried doing it with html so I wrapepd that whole section around an <a id="2"> tag and recalling it in the menu with website.com/#2 and this works partially BUT it now sees that whole section as a hyperlink thus messing up its formatting. Is there another way of doing this with php?

I'm not sure if I understood what you need correctly, but in order to link to an element on the page, you could do the following:
Option 1: Set an id attribute to the element:
<section id="mysection">...</section>
Option 2: create an empty anchor tag with an id attribute at the top of the section element:
<a id="mysection"></a>
<section>
<h2>My Section</h2>
<!-- ... -->
</section>
Then target the section's id with your anchor tag:
Go to My Section
JSFiddle Demo.

Related

problem with custom url to the featured image

I have used a wordpress plugin (Add Featured Image Custom Link) to insert custom url to the featured image.
I have two functionalities in my portfolio:
when the user click on image it will popup the image; this is working properly.
the anchor tag I have used for the link which I have added to featured image I want to redirect to the website of which I have added the link on featured image
How do I do #2
<div class="option inner">
<div>
<h5><?php the_title(); ?></h5>
<?php
$url = get_the_post_thumbnail_url(get_the_ID(),'full');
?>
</div>
</div>
If you want to get the input from the (Add Featured Image Custom Link) WordPress Plugin it's easy. This code will add the link if the input is not empty.
<div class="option inner">
<div>
<h5><?php the_title(); ?></h5>
<?php
$cust_li_fi_value = get_post_meta( $post->ID, '_custom_url_image', true );
if( $cust_li_fi_value ) { ?>
<?php }
?>
</div>
</div>
Cheers,
Happy Coding :)
I got my solution by one way i think it is not the proper way
that is, inplace of i wrote the funciton the_content
and inside editor of the wordpress i use the custome html like this

bootstrap - left menu link click to open a new page within a div section

Ref: http://startbootstrap.com/template-overviews/simple-sidebar/
From the above sample, on clicking the left menu link I would like to load a new page in the body section and also want to maintain the left menu navigation.
i.e on href link click I want to load a new page within the .
Thanks
Update:-
Each left navigation links loads a different html file and these different contents to be displayed in the main section accordingly.
I already did what I think you want. So, you can use a list. Each element of your list refers to a different div.
For exemple, here is my code :
<div class="tabs" id="tabs">
<ul>
<li>One</li>
<li>Two</li>
</ul>
<div id="tabs-1">
<?php include('Page1.php');?>
</div>
<div id="tabs-2">
<?php include('page2.php');?>
</div>
</div>

input type text attribute value, make it blank with external css

I have integrated HTML Template to wordpress theme. Now, for search box I dont want value attribute to be displayed. But by default wordpress`s search box displays with that value attribute.
My search box(Wordpress) coding is like below. It is in header.php file
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="widget-area" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- .widget-area -->
<?php endif; ?>
From above coding the search box is generated with that value attribute. How to make it blank with external css. Thanks in advance.

Magento homepage layout

For my project http://www.merekhayaal.com/ (Magento CMS) I am trying to get the Masonry layout and product sliders full width. They are currently 960px which is because they are contained in the div 'main'. The Masonry layout is getting its images from the class 'content', which apprarently linked to Content > HomePage > Pages > CMS > Magento.
When I try to move the 'content' class in 1column.phtml to outside 'main' (whose width is set to 960px) i get the desired result but it also causes content in other pages like Contact us, etc to go full width, which breaks the site design.
Is it possible for a div to be bigger than its parent div? Any suggestions what should I do?
The best solution would be to create a new layout specifically removing the contained div "main", and assign it to your homepage.
Documentation on how to create a new layout template:
http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/0_-_theming_in_magento/adding_cms_layout_templates
I was running behind a similar solution, and I did the following: cloned the [layoutcolumn].phtml desired in [package]/[theme]/template/page and put the slider block within the div page, like this:
<div class="page">
<?php echo $this->getChildHtml('header') ?>
<div class="main-container col1-layout">
<div class="main">
<?php echo $this->getChildHtml('breadcrumbs') ?>
</div>
</div>
<?php echo $this->getLayout()->createBlock('[myslide]/[myslide]')->setTemplate('[myslide]/[myslide].phtml')->toHtml();?>
<div class="main-container col1-layout">
<div class="main">
<div class="col-main">
<?php echo $this->getChildHtml('global_messages') ?>
<?php echo $this->getChildHtml('content') ?>
</div>
</div>
</div>
<?php echo $this->getChildHtml('footer_before') ?>
<?php echo $this->getChildHtml('footer') ?>
<?php echo $this->getChildHtml('global_cookie_notice') ?>
<?php echo $this->getChildHtml('before_body_end') ?>
</div>
So I did not lose the design of other blocks.
I don't know if it's the best solution, but it worked.

Wordpress Post Text Excerpt in Sidebar?

I am curious if there is a way to output an excerpt of the post txt into a sidebar, but only the sidebar for that post.
What I have tried is using the get_content loop in the single.php into a custom sibar that I have created inside another DIV, but it displays the post txt, Comments and images in the sidebar.
<div id="Sidebar">
<?php the_content(); ?>
</div>
Question: Is there anyway to display Post text in the sidebar?
You could do this:
<div id="sidebar">
<?php
the_content();
//display only on post page
if(is_single()){
the_excerpt();
}
</div>
Hope that works!