Jay
Forum Replies Created
-
Forum: Themes and Templates
In reply to: [Cosparell] No Featured image=broken image & Avatar questionChevy, while I’m not the author of the theme, I have been hacking away at it for a few days to customize it to my needs.
I can help with #1, though I’ve not had the need to modify the code in such a way to handle #2.
This theme sets a ‘default’ featured image, which is a no no of course, so if you don’t set a featured image, you’re going to get the default, in this case it’s going to be
images/default.pngSo, if you open up content-single.php and remove the else statement, you will stop getting a default featured image.
// content-single.php lines 32-45 <?php if ( has_post_thumbnail( ) ) { the_post_thumbnail( ); } // Remove this else { //To display the default featured image in posts $img_url = esc_url(get_template_directory_uri() . '/images/default.png'); echo "<img src={$img_url} >"; } // Do not remove past here. ?>Forum: Hacks
In reply to: How run code based on category?You’ll want to look at the template hierarchy here: https://developer.wordpress.org/themes/basics/template-hierarchy/
Or if you’re looking for a more linear and less intrusive approach, try the pre_get_posts hook with conditionals like
is_search()and so on.https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
Forum: Hacks
In reply to: Tabindex registration formCheck the register_form() function, which you can alter. More on the codex: https://codex.wordpress.org/Plugin_API/Action_Reference/register_form
Also shows you how to modify the form’s current fields.
Forum: Hacks
In reply to: How to apply JS to a link on front-page.php?While the javascript-only approach is fine, I can still bypass that and go directly to the URL, or turn of JS entirely.
WordPress has a mechanism just for this, abit without the popup of course.
Using Password Protection – WordPress CodexIf you want ONLY the js method, then squarebracket’s approach is definitely spot on.
Forum: Hacks
In reply to: Combine/mix WP themesMerging two different themes will definitely be a pain, unless, both themes use a common framework, like bootstrap or foundation. Even then, you’re still looking at a significant amount of time needed to merge styles and resources.
More than likely HTML elements will have different class names, so you’ll need to change those, or bring in the appropriate css. If the css is hierarchical then that’s another problem, you’ll have to break that out. If the theme has Sass or Less files, this’ll be a lot easier.
Don’t even get me started on javascript… that’s a whole other beast entirely. Depending on themes, you may have issues there.
Consider looking at the WordPress Template Hierarchy to get an idea of which theme file does what. This way, you’ll know more of what you have to move, instead of attempting to combine an entire theme into another one.
The latest release SHOULD support caching now. I’m now using cookie.js instead of PHP for cookie handling so cached pages should be fine. Be warned, due to the css changes, if you have custom CSS, it will break with this update.
Forum: Fixing WordPress
In reply to: Tables Needed Repair and now Repair FailedI’ve never really used WP to repair crashed tables, may I suggest, if you have the capability, to use MySQL directly?
REPAIR TABLE wp_options;You can also run that in PHPMyAdmin under the sql tab, though the MySQL terminal may give you abit more of an output.
More info on REPAIR TABLE: http://dev.mysql.com/doc/refman/5.1/en/repair-table.html
Forum: Fixing WordPress
In reply to: add WYSIWYGForum: Fixing WordPress
In reply to: Can't update core or pluginsCheck your error logs for the apache installation, or your debug.log in wp-content/ if you have that enabled. There could be many different things at play here.
If you’re on a Centos install you can check /etc/httpd/logs/error_log, other systems may vary by distributor.
The first that comes to mind is maybe the storage is full?
Forum: Hacks
In reply to: Deactive certain plugin on post edit screenNot sure why that’s happening, but sounds like a bug that needs reported to the plugin author.
You’ll need to use deactivate_plugins in conjunction with the admin_init hook. Again, I don’t recommend this, but if you must: http://codex.wordpress.org/Function_Reference/deactivate_plugins
Forum: Fixing WordPress
In reply to: logoYour code has conditionals but it’s only checking if both is set, if so, it’s displaying both logos. Instead, break the two down into one single conditional, and set the image source and id’s depending on what you want. You could probably compress this a bit, but should do the job.
<a> <?php $src = ''; $id = ''; if( isset( $logoURL['background-image'] ) ){ $src = $logoURL['background-image']; $id = 'main-logo'; } elseif( isset( $smallLogoUrl['background-image'] ) ){ $src = $smallLogoUrl['background-image']; $id = 'main-logo-min'; } ?> <img src="<?php echo $src; ?>" id="<?php echo $id; ?>" /> </a>Look at wp_get_referrer() ( WP ) and strpos() ( PHP ).
$referrer = wp_get_referer(); if( strpos( $referrer, site_url() ) ){ // Was referred by current site. } else { // Was an external referrer }Using site_url accounts for proper http protocols, so this should give you what you’re looking for.
EDIT: you can compare the permalink to the $referrer as well via the get_permalink() method.
Forum: Installing WordPress
In reply to: Theme installation warning errorOne of two things, either WP.org’s SSL cert has expired, which I doubt, or your system’s date/time is wrong. I had a similar issue where my son had changed my date-time on my laptop, only to be told by google that their SSL cert was invalid.
If for some reason that fails, it could also be your local xampp install. Try running xampp-control as admin then re-doing the template install. If that doesn’t work, try installing the latest xampp.
I use xampp as well locally, currently v3.1.0 Beta 6, and haven’t had that problem on Win 7 Pro.
Forum: Fixing WordPress
In reply to: Error installing Plugins/Themes – Could not copy fileAhh ok, then instead of using
/acta/as the directory, try using justacta/without the leading slash.It’s been so long since I’ve had to do this, I’m abit rusty.
Forum: Installing WordPress
In reply to: Error: 'unexpected end in /user.php line 416'This definitely isn’t a bug in 4.0, I have multiple 4.0 installs. Looking at core there’s no unexpected end.
https://core.trac.wordpress.org/browser/tags/4.0/src/wp-includes/user.php#L416
I would compare your user.php to this one. Also, don’t forget to check your mu-plugins folder for possible files.