Link to custom php theme page in wordpress - php

I want to link a template php page (header.php) to a custom php page (cmenu.php) I made in the same theme.
I've searched on a lot of websites via google and also through the Wordpress Codex on how to accomplish this but I can't seem to find it.
In my header.php page I have a div which I want to have an url href link to my custom menu called cmenu.php. (I want to link it to that page to be more mobile friendly.)
I tried te following codes I found in the codex and google but none of them work:
get_cmenu()
get_template_part('cmenu')

Make the page you want to link to a template page and make a page and assign that template to it.
In a template page you can run all custom code you want.

Related

Dynamic body in html for making wordpress theme

Can you help me, please ? Maybe this question is stupid but I am new in Wordpress. First I have created project using html and css, javascript. Then, I have converted my html code to wordpress theme. For example I have written get_header() instead of html head and get_footer() instead of html footer. Finally I must do dynamic my project's body but I can't. For example when i change page, header and footer must stay in its place but body must changing. Problem is I do not know to write code in my body section. my code's seem
I have called my other section though get_template_part().
I have tried to write my html code in adding wordpress page, to be more clear, in wordpress dashboard. When I change page, body's seem must changing.
What should i do, please ?
In your templates add the HTML of particular pages like the home page and other cms pages and in the admin dashboard go to the Pages section in the page template and assign the particular page template for example you have created a home page template for the main page go to pages in admin dashboard in page template assign the home page to the page then you can see the HTML of the page on frontend.

Using Wordpress Navigation Menu on non-Wordpress Web App

I need to use the main navigation menu from a wordpress page on a non-wordpress page so that the menu can update on the non-wordpress page dynamically.
I want to be able to update the menu on the wordpress backend, and have it automatically update on the non-wordpress page.
What would be a good approach for accomplishing this?
Thanks!
It's possible to include WordPress on a page without using a WordPress theme. Add this to the top of your file (and make sure the path to wp-load.php is correct):
<?php
define('WP_USE_THEMES', false);
require('wordpress/wp-load.php');
?>
I've done this before when I want to tap into useful WordPress stuff (like a contact form plugin) on a page that isn't on the WordPress part of my website.

PHP: Wordpress Test Page

The problem!
I have a Wordpress site up and running. I wanted to add a custom page, for example if I browse to site.com/mytest it would display just Hello world without any css etc.
What I've tried
I added a mytest.php file under var/www/wp-content/ and tried to browse to it. (The code simply echo a static text).
What I got was simply a 404 page by Wordpress.
To view the file you uploaded, browse: site.com/wp-content/mytest.php
If you just type site.com/mytest , wordpress will thin you are reffering to a page stored in the wp-database. Since it's not you cant view it.
To add the page in the menu, use custom menu and add as "Custom link".
You can make your page a wp custom page template by adding this at the top:
/*
Template Name:Your Page Name
*/
Then create a page in the wordpress dashboard pages and select your page template from the page template dropdown.

How to make Wordpress Custom page

i m a newbie to wordpress. I have started theme development and encountered these problems. I think these kind of problem does have a solution, but i m not able to find it out.
I m trying to make a custom page. Uptill now i have made header, footer and main index page.
I see that whenever my theme is activated, I see these default index page, with header and footer assign to it.
I have also made some cutom about us , contact us pages using the Add Pages Functionality of wordpress.
My Problem:
1.Now I m trying to make custom product page where I will have more than 100 images on that pages, and then i can change the images, add the images and description and the link url in future. I have made some html code and put it in the text Tab . I can also see the images on the frontend of the Custom page. But my template breaks. Images goes up and description goes far below.
Also i wanted to add fancybox to all the images which are goin to be replaced or added. But again my template breaks.
So can we make custom.php page and do some coding or anything which you feel is the right way of doing it, Please let me know.
Firstly create product.php page in templates folder using below code on top
<?php
/*
Template Name: My Product Page
*/
get_header();
// write your code here
get_footer();
Then, assign the above template to the page in admin.
Then, that page you can call in menu.
For more detail, check here :- http://codex.wordpress.org/Page_Templates
Actually you don't really need to create a custom template for this unless if you are planing to use that same template on another page.
If your page name is products , just create a file called page-products.php in your theme root. and write your code inside that page.
If your planing to develop themes first be comfirtable with wp template hierarchy.
http://codex.wordpress.org/Template_Hierarchy

Adding inline wordpress comment functionality to a non-wordpress page

I have created a wordpress.org blog on my website but I do not use the actual blog page to display the blog posts. Initially I tried to style the wordpress blog to match my site, but since wordpress' theme is too constricted I decided to use "the loop" to gather the_author_posts_link, the_title, the_content, etc and display them on my main page. (reference: http://www.corvidworks.com/articles/wordpress-content-on-other-pages). The problem I am running into is the comment section. No matter what, I cannot seem to find a way to add comments to my front page using php. I know I can get my post content to display by calling the_content(), but I cannot seem to find a similar function for comments. I'm open to any solution that will allow my pseudo-blog to display comments under each post.
Thank you!
Should be <?php comments_template(); ?>. Look in your theme files for that template tag. But it working depends on if you've correctly included the blog header on your non-WP pages.

Categories