Rastislav Lamos
Forum Replies Created
-
While your approach works, you could have simply created a new template file in your theme directory with the needed code and assign that template to a specific page in your WP admin panel. That would be a more WordPress-like way of doing things (instead of loading the whole WordPress in a custom way by calling
wp-load.php
)So you want to create a custom WordPress page on which you would list the mp3s info and use
download.php
as its template file? If yes, each WP template file must consists of mandatory comment<?php /* Template Name: My Custom Page */
which WP parses and you can then select this file as the post’s template file. To include header and footer, you simply call
get_header()
andget_footer()
in that file anywhere you like to.To learn more about custom WP templates read about it on Page Templates.
Forum: Fixing WordPress
In reply to: Having troubles removing a menuWell, if you just put that display to none in the general css without further specific selectors for a specific page(s), it would definitely affect all of the pages:
// Don't do this #main-nav { display: none; }
What you are looking for is a special css class given for the specific page on which you want the menu to be removed on. Good thing is that proper WordPress theme uses
body_class()
function to output classes for the <body> tag. I can see this in your code, so only thing you need to do is add a condition that “if the page I’m currently visiting is of ID or type this and that, add a special class to thebody_class()
function. For example:[... previous code in header.php ...] presscore_icons_for_handhelded_devices(); } wp_head(); ?> </head> $additional_classes = ""; if (is_single(1)) { // '1' is ID of your specific page $additional_classes = 'page-no-menu'; // whatever the name } <body <?php body_class($additional_classes); //this is important ?>> [... the rest of the code in header.php ...]
Now, you would put
.page-no-menu #main-nav { display: none !important; }
in your main css file at the end of it.
Anytime you visit page with the ID of ‘1’, that new class would apply to the body element and your custom css would take precedence.
Further reading if having trouble:
setting-the-body-class-name-for-a-page
body_class()
Conditional TagsForum: Fixing WordPress
In reply to: 2 domains 1 database ???In this case, point both domains to the same server (its IP address). This way you only need one WordPress with one database and both domains will show the same data.
Forum: Everything else WordPress
In reply to: Server configuration of WordPressTo be honest, I’m not using much plugins for longer periods of time so I can’t say for 100% that it is compatible with all. On the other hand, I’m successfully using hhvm with woocommerce, revslider, visual composer, w3,essential grids, to name a few.
Forum: Everything else WordPress
In reply to: Server configuration of WordPressYou could try using Facebook’s HHVM instead of PHP-FPM (usually much faster than PHP 5.6) and use nginx’s FastCGI cache for caching the output from HHVM (= page cache).
Then make use of W3 Total Cache for browser and object caches and for minification of resources (js, css).
Lastly, sign up for free CloudFlare account which gives you free CDN, further resource optimizations (js asynchronous loading, images compressed and CDN-ed, SPDY) and also a free SSL cert (= so you can use https).
I’m using this combo at my sites and apart from having to restart HHVM once in a while (done by monitoring script), I’m running fine.
If you want some specific resources, look at my delicious.com bookmarks profile where I’m gathering all performance tips and tricks :).
Forum: Hacks
In reply to: if_is_home broken in version 4.1?It is working fine for me (using WP 4.1.0).
Just a note, you could write the code like
<?php if ( !is_home() ) { instant_breadcrumb(); } ?>
instead (shorter and nicer ??
Forum: Fixing WordPress
In reply to: 2 domains 1 database ???If you will have the exact same content on both domains (.org and .com), it will hurt your SEO. Why not just use one domain (e.g. woaat.org) and redirect woaat.com to woaat.org?
Forum: Fixing WordPress
In reply to: Having troubles removing a menuFirstly, the primary menu should be
echo
-ed in theget_header()
part, soheader.php
file would be more useful to be pasted here.What is the link to your site? We could remove the primary menu with CSS, such as
.your-menu-class { display: none !important; }
You need to substitue
.your-menu-class
with a proper CSS selector for the primary menu.Forum: Hacks
In reply to: Properly Run Pop Up-Javascript in WordPressFirstly, where do you want the popup? If on homepage, you can use
index.php
for that purpose. Then, before loading WordPress header (get_header()
), you need to enqueue the JS (popup.js
). Use wp_enqueue_script. Also don’t forget to includejquery
andjquery-ui-core
as dependencies to that JS, sopopup.js
is loaded only after those two are.// index.php <?php wp_enqueue_script('my-popup', get_template_directory_uri() . '<path-to-popup.js>', array( 'jquery', 'jquery-ui-core' )); get_header(); // rest of the code (including html for popup)
You can’t use
$
as jQuery in the global JS scope because it’s loaded in No Conflict Mode. However, you can use$
in a function’s local scope (e.g.jQuery(document).ready(function($){ // you can use $ instead of jQuery here });
After that, put your popup’s HTML in the
index.php
somewhere after loading header. And you are done.If you want to understand WordPress template files hierarchy in more depth, study this diagram WP template hierarchy
Forum: Hacks
In reply to: Add meta value to custom post on publishAccording to the source code of WordPress
wp_transition_post_status()
which handles the transitions of post statuses, the first argument passed to the callback function (in your caseon_jobs_publish
) is post $ID, not $post. This way you could edit your function to use that $ID in the insert query instead of $post->id.Forum: Fixing WordPress
In reply to: my feed is not working and return a message "XML parsing error"You have this:
<div style='text-indent:-8989em'> </div>
on the 1st and 2nd lines, which is not valid XML. Remove it.
Forum: Fixing WordPress
In reply to: Shortcode ConditionIf I get that right, if
$client_name
is empty (empty string), you don’t want to show anything, right? If yes, it should be enough to add oneif
condition in thewhile
loop, such as this:while($q->have_posts()) : $q->the_post(); $idd = get_the_ID(); $client_name = get_post_meta($idd, 'client_name', true); if (empty($client_name)) { return; } $company_name = get_post_meta($idd, 'company_name', true);
Forum: Fixing WordPress
In reply to: 'og:title' of type 'string' was not provided.You need to provide valid
og:
properties for Facebook to correctly create descriptions and other stuff. Read this how to use og meta tag for facebook shareWhen do you get that error?
wp_json_encode()
is not located inwp-admin\includes\misc.php
but inwp-includes\functions.php
. That function was added in the4.1.0
WordPress update, so rather new.