Hide a post but make it accessible via a link Wordpress - wordpress

I'm trying to hide certain posts from displaying on the site using custom code. I CANNOT USE A PLUGIN!
I would like to do something like IF the page is named the-hidden-page do not display it anywhere on the site BUT someone can access it using a URL... For example, http://thedomain/the-hidden-page.
I haven't been successful finding sample code except for this -
<?php if (is_front_page() && !is_paged()
) $posts = query_posts($query_string . '&cat=-33,-66'); ?>
This code is using category names rather than page names. Also if I used the code above I'm not sure where to add it to. I tried function.php but that didn't work.
Can someone provide an example of how the code could be written to hide post with a certain name?
Also tell me in what file I should add your code to?

Related

From which wordpress file i can change this page's layout

I am currently using wordpress for the website development and i want to change this page's formatting which is having url
http://www.selfmadesounds.com/dev3/?catid=featured&slg=featured3
I need to change this page's formatting such that i can exclude out the extra things from this page.
you are probably looking for category.php.
If you are a beginner with templating / themes / wp in general, you can simply search for class="category" and add a small string INSIDE the div in all of the template files where the search hit, one by one , and see which one is the one you look for .
You can insert <? php echo 'This is my page'; > or simply insert XXXXXX.
but just make sure you are not doing so in header.php, sidebar.php or footer.php - those will in all likelihood will appear on ALL your pages . ( also functions.php is to be excluded , but not in all cases ..)
but like others said, you should read the codex page about template hierarchy. it can also be any other filename (custom-loops.php file, custom-category-filename.php etc. depending on theme.
Edit I
I think you are mixing a bit of concepts here .
this line :
http://www.selfmadesounds.com/dev3/?catid=featured&slg=featured3
Is not a page, it is a URL with get parameters , and it represents a query for category : Featured with Slug : featured3 .
As for itself , it is NOT a page , it is a Query ( and i suspect that it is a plugin or theme related ). The query later produces , or renders a page .
At any rate , my advice still stands , Put a dummy code inside all the template pages and see which ones is your page .
For the rest - if you will supply more info or code , people could help more .
You have to check the Wordpress Template Hierarchy, a quick guess would be single.php from the active theme, but there is no way to be sure other than actually searching in the theme

How can I create a link to a specific page in wordpress?

It seems like a simple task, but I'm having difficult time finding any information on this. Basically I have an "Events" page created in wordpress to which I want to create a link on my main page. I do not want it to be static like (https://mysite.com/events). Is there a way to do it dynamically?
You want to use the get_permalink() function to write the link - http://codex.wordpress.org/Function_Reference/get_permalink
This function accepts an argument which is the post or page ID (and defaults to the ID of the current page), so if your Events page is ID #11, it would look like to following to also have the link text match the page title (should it change to "Events!" in the future, for example):
<?php $events_page = get_post(11); ?>
<?php echo $events_page->post_title; ?>

How to create a profile page in Wordpress Multisite

I can't find a way to create a front-end profile page for all users under Wordpress Multisite Network. I also wanted the profile page to be on the main site and not on sub-sites if possible. I don't want to use any social network plugins like buddypress.. I just want to create a page like http://mainsite.com/profile/username
Is there a way to accomplish this?
Maybe you might check out Buddypress which is a social layer on top of Wordpress and is able to do what you need (i.e. something like http://mainsite.com/profile/username).
Link: http://buddypress.org/
More specifically, in Buddypress the default behaviour is http://mainsite.com/members/username
I have noticed that you have edited the question and that you are looking for a way to accomplish this without any plugin. There are a series of tags in Wordpress to show the author's data. So basically you could create a page and then use the_author_meta tags. For example the following code echoes the first and last name of a user whose name is stored in $userID:
<?php
$pagename = $userID;
echo the_author_meta(user_firstname, $userID );
echo the_author_meta(user_lastname, $userID );
?>
Please note that the variable $pagename is empty in case you use a static page as home page, but it is not your case.
Source: https://codex.wordpress.org/Template_Tags/the_author_meta

Alternatively presentation of the archive

I'm searching for an alternativ view of the archiv output page.
So if you click on a archiv link you get a view e.g. of the Month.
And exactly this Page where i get the filtered output i want to apply some changes.
So i mean not:
wp_get_archives()
Best regards Illu
If you just want to make a few small changes, then just filter it with the wordpress function is_archive(), e.g.
<?php if (is_archive()) { ?>
Say hello to the archeologist users
<?php } ?>
...otherwise, if you want to have a completly different template for that page, then just create a file called archive.php in your theme directory. Hope I understood your question right :)
Some more resources for the is_archive() function is to be found here - well explained examples. And some more information about template files are here

How do I create a custom WordPress page?

I want my WordPress blog to have a page called music. On that page I will query the DB for posts with the category music and then change around the look and feel of the posts. So I can't just put a link to /categories/music/ because I want to do custom work on the posts.
Should I put this code in a separate php file and link to it? I think I may lose access to all the nice WordPress API calls if I do that.
I was thinking about using a filter, but I am not sure which one to use. I was thinking something like the following except the_title has not been grabbed yet so I cannot check the title.
function show_music(){
if( is_page() && the_title('','',false) == 'music' ){
echo "got here";
}
}
add_filter('pre_get_posts', 'show_portfolio');
How would you go about this?
You need to put the below code in the file, and then put the file in the Theme folder. Then you can create a page using Wordpress pages and select a page template with the name you put in this comment:
/*
Template Name: Something Goes Here
*/
You need to create custom page within your theme. If you dont have idea how to create custme page or template page in WordPress theme then view my easy tutorial How to create template page in WordPress

Resources