How to link child pages in Wordpress to the parent? - wordpress

Odd question and maybe my logic is off on this one, but I have this structure in Wordpress:
Page 1
Child page of page 1
Child page of page 1
Page 2
Child page of page 2
Child page of page 2
Child page of page 2
In my theme I output this as one page per parent.
For example:
The layout is
<h1>title of page 1</h1>
<p>content of page 1</p>
After that a few small blocks:
<div class="box first child-page">
box with content of child page of page 1
</div>
<div class="box second child-page">
box with content of child page of page 1
</div>
<div class="box last child-page">
box with content of child page of page 1
</div>
But; now my problem! When someone uses the search box, The child pages, with their unique permalink are also shown, which is correct, but I need them to link to the parent page. Child pages should not be visited as a unique page, but the content has to be searchable (because, the content does exist on the webpage). Hope you guys understand what I'm trying to tell. I tried to 301 redirect the child pages to the parent page, but I need something easier for my client to be able to create child pages, and not having to worry about 301 redirects.
Regards.

to get parent url you can do this inside the loop of child page
<?php
$parent = get_permalink($your_child_loop_variable->post_parent);
?>

Related

WordPress - Excluding div container from next pagination page

I have such a text container. He would like it to appear only on the first page of the blog's pagination.
<div class="column mcb-column mcb-item-c0belar2g one column_visual">
<h2>Title</h2>
<p>Lorem Ipsum Dolor</p>
</div>
I have a text container generated by Muffin Page Builder in WordPress. He would like it to appear only on the first page of the blog's pagination. I tried to create a code like this:
if (1 == $ paged) {
your container code
}
Unfortunately it doesn't work and I don't know if I need to create a function to hide this container on the following pages of pagination?
Here is a link to this blog page
I am trying to find information on the Internet, but so far I have not been able to find anything about it. Please help.
Image of this container

get the page template unique from the slug in wordpress

Hi i have this page template past conferences single and i have this href tag
<a href="/past-conferences-single/<?php the_slug(); ?>" class="wrapper" style="background-image:url('<?=$url?>')">
and my href link goes this way
past-conference-single/2013-inagural-diversity-abroad-conference-5/
i want that when i click on this page goes to this page template past-conference-single and with the content is dynamic based on the slug.
How will i able to do this?
Any help is muchly appreiciated. TIA

drupal 7: custom design theme a block created with the Views module

i create block with views module for Print Promoted to front page, this worked and i see result in my front page. this views worked with field and i print title, thumbs, content. now i need to custom this theme views for show in jquery content slider.
i click in advanced->theme->information i see this:
field content revision: views-view-field.tpl.php, views-view-field--title.tpl.php, views-view-field--frontpage.tpl.php, views-view-field--frontpage--title.tpl.php, views-view-field--block.tpl.php, views-view-field--block--title.tpl.php, views-view-field--frontpage--block.tpl.php, views-view-field--frontpage--block--title.tpl.php, views-view-field--block-1.tpl.php, views-view-field--block-1--title.tpl.php, views-view-field--frontpage--block-1.tpl.php, views-view-field--frontpage--block-1--title.tpl.php
But i don't find any .tpl.php theme files for edit theme design using html and css. how to create custom design theme for print my result with this format:
<div id="content">
<ul>
<li>
<div class="title">title1</div>
<div class="thumbs"><img 1 ......></div>
<div class="content">content1</div>
</li>
<li>
<div class="title">title2</div>
<div class="thumbs"><img 2 ......></div>
<div class="content">content2</div>
</li>
</ul>
</div>
I think the Views 2 theming guide has already explained everything clearly. Just follow the steps there and it only takes just minutes.

same css styling renders different positions on same ad

Ads on this page (Fixture Info) are not displayed at same position as this (Home Page). Both have the ads placed in <div class="right-ad">, and use the same style rules.
Any idea how to fix this & display ads on Fixture Info in same position as Home Page?
You should add more detail in your question and not really expect people to go to your site and analyse your code.
Never-the-less..
Check your code and you will notice that on your Home Page the <div class="right-ad">'s parent is <div class="main">. Whereas on Fixture Info the <div class="right-ad">'s parent is <div class="container">.
I would assume that this is the cause of your problem. Go over your code and you'll probably find that on the Fixture Info page, putting the ad's <div> in the <div class="main"> will solve it.
I.E:
Your Home Page:
Your Fixtures Page:

Facebook like button on Wordpress

I added a like button to my index.php and single.php on yssencial.com (using wordpress)
but on the main page (index.php) it is not sharing the article but the site url (www.yssencial.com) instead.
You need to set the data-href property of the individual posts to your posts url. Otherwise it will use the page that it is actually on, eg your home page.
<div class="fb-like" data-href="http://www.yssencial.com/2011/09/20/terra-nova-quando-o-parque-jurassico-encontra-a-maquina-do-tempo/" data-send="false" data-layout="button_count" data-width="140" data-show-faces="true"></div>

Resources