wordpress menu link target to _iframe - wordpress

Instead of having the link opened in a new tab I would like to the link to be opened in an iframe that's on the same page.
Example:
I have my front page with an iframe on it. If I click on the menu items i would like to have the urls loaded in the iframe.
I can't seem to find an answer for this.

Alter the iframe in your front page as below
Make sure the iframe contains a name attribute (name="main-section")
<iframe name="main-section" src="home.html"></iframe>
In your menu items make sure the target attribute redirects to main-section (target="main-section"). This is an important step.
Example:
I am pretty sure you can achieve the above steps in wordpress.

Related

replacing anchor # to full url in wordpress posts

I trying to replace the anchor "#downloadbutton" to the full url in all posts.
for example:
#downloadbutton = https://mywebsite.com/kindness-and-gentleness/#downloadbutton
#downloadbutton = https://mywebsite.com/islamic-etiquette/#downloadbutton
#downloadbutton = https://mywebsite.com/hindrances-on-the-path/#downloadbutton.
The reason for this is that when I create excerpts which include anchors from the posts. The anchor urls are not working except if i go back to and change the anchor #download to absolute (full) url. and there many posts. Is there any way to do it through php snippets. Am using wordpress.
Thanks in advance
You can't remove hyperlinks hooks from the url. Hyperlinks hooks are just a way to navigate to a specific content more quickly. For example https://ownwebsite.com/#testimonials will show you the testimonials section straight away on page load.
The only thing you can do is replace the url from the button with your specific url, that way instead of having an hyperlink hook button, you would have a regular plain'ol button that redirect you to a page or else..
You can learn more about the <a> html5 tag behaviour # https://www.w3schools.com/tags/tag_a.asp and you can see a live example of the behaviour # https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_a_href_anchor

Drupal, need to link an image-block to a node in colorbox format

I am trying to make a block of image (in left sidebar of the home page) to link to a colorbox.
For example I have a block with an image in home page. All I want to do is that when I click there the colorbox open with the content-type, for example a gallery of images. I tried everything for two days, but I couldn't make it work. All I could do is to make the colorbox to work inside the node but no directly from the homepage, and less from an imageblock in the homepage.
I would be appreciated if anyone can help me. Thank you!
I think the Colorbox Node module can be of help. That module enables you to open any page inside a colorbox modal without the header and footer.
In your use case you can make a link in the image block which looks likes this
<a class="colorbox-node" href="blogs/my-example?width=600&height=600">My Example</a>
When clicking the link, the link will open in a Colorbox modal. For more info on supported features and usage, take a look at the module's project page.

How to redirect a wordpress page to a section of an existing page?

I know there are ways to URL-redirect a Wordpress page to another page via PHP and that you can use HTML to link to a section of a page...but how can I redirect to a section page?
For example, on my home page I have different sections, services and projects. In the main navigation I have a services link. How can I make that open the homepage but just on the homepage.
Ok so just tested this on my local wp install.
On the page you want to load part way down add the anchor you require eg:
<a id="Services"></a>
Then in wordpress > appearance > menus, select your menu. Then on the left hand side, click on 'Links'
Add the full URL of your page eg:
http://mywebsite.com/home/
Add to this the '#Services' tag to make it look like:
http://mywebsite.com/home/#Services
Then add it to your menu and save.
You should then be able to click on that button on your menu and the page will drop to the anchor tag when clicked. If you're having trouble with the poundsign/hashtag (#) then you might want to check for conflicting issues in plugins / your functions file - and even wordpress.org uses them on their own site.

How to add a link to an anchor in Drupal 7?

I'm creating a website with Drupal 7.
I've a contact block at the bottom of the page (as a footer page), but I need to put a link into a menĂº with an anchor. I mean, when an user press that link, it must scroll down the page to the contact block.
How could I do this? I don't see anything.
Thank's
The module Menu attributes is your life saver, install it, so you can add the name attribute to your link
I believe you need to use the Menu token module in order to get the path to the current page for the anchor link. Path for the menu item should be something like:
[current-page:url:path]#footer
Its simple! You just create a link and go to page content edit option through Drupal admin. In the bottom of edit content page you will get a URL path settings, there is url alias field on there. You just put path in your field.

Is it possible to link to the same page from wordpress page menu?

I have a big one page wordpress site and a menu created from wordpress admin pages panel. I added everywhere in my main page such links like <A NAME="gohere"> and similar. Now I need to add href's to the page menu name's like <a href="#gohere"> Actually I do not know is it possible to do this from the wordpress admin page's menu or maybe anybody know where these pages are stored so that I could add the links manually in the file's. Thanks!
Tried plugin "Page Links to" and added something like <A NAME="gohere"> as a link in where, but unfortunately plugin do not understand this,
Regards,
You shouldn't use the name attribute of the a element. Instead, assign ID values to the elements of your page, for instance:
Link to foo
<div id="foo">
<!-- Your foo content goes here -->
</div>
For your question: You can manually add links to your WordPress menu, entering custom values as the href attribute. To add a link, enter #foo in the URL field of the custom link in the menu admin section.
Are you using the WordPress's built in menu manager? (Appearance -> Menus)
If so, then yes it should be fairly simple.
First you need to mark the areas within the page you want to link to - setting an ID to the element is enough. So if you want the browser to scroll to the top of the latest posts when a link is clicked, for example, you need to add an ID to the tag that contains the latest posts. Then give it a unique name (this is important). So something like id="latest_posts_area" should do it. Be warned though, you may need to edit the template files to do this, so ensure you have taken a backup of your theme just in case you make any mistakes.
So, if you have:
<div class="latest_posts">
You would edit it to be:
<div class="latest_posts" id="latest_posts_area">
Then, in the admin menu, when adding/editing a link, you simply set the URl as #latest_posts_area - then on every page that link is visible, clicking it will scroll the users browser to the to the top of the tag you added the ID to.

Resources