michal.lausch
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom post type URL rewriteWe may be closing to something:)
I need few more lines of code.
This:
register_post_type('logitrans-service' , $args);
is what generates post type.
Can You paste here args?
It should look somewhat like this:$args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'service', 'with_front' => false ), 'capability_type' => 'post', 'has_archive' => false, );
M
So my next move would be to customize function strip shortcode.
function remove_shortcode_from_index($content) { global $post; if ( is_singular('portfolio') && 99 != $post->ID ) { $content = strip_shortcodes( $content ); } elseif (99 == $post->ID){ $content = strip_shortcodes_but_protect_ninja( $content ); } return $content; } add_filter('the_content', 'remove_shortcode_from_index');
And customized strip_shortcodes (im sorry, but its not complete and i need to leave for a while and cannot test it, it require You to alter it a little bit in selected place):
function strip_shortcodes_but_protect_ninja( $content ) { global $shortcode_tags; if ( false === strpos( $content, '[' ) ) { return $content; } if (empty($shortcode_tags) || !is_array($shortcode_tags)) return $content; // Find all registered tag names in $content. preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches ); $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] ); if ( empty( $tagnames ) ) { return $content; } // here You should remove from $tagnames ninja form tag // via var_dump( $tagnames ) You can find ninja tag // via $tagnames = array_diff( $tagnames, array('ninja_tag_here')) You can remove it from $tagnames $content = do_shortcodes_in_html_tags( $content, true, $tagnames ); $pattern = get_shortcode_regex( $tagnames ); $content = preg_replace_callback( "/$pattern/", 'strip_shortcode_tag', $content ); // Always restore square braces so we don't break things like <!--[if IE ]> $content = unescape_invalid_shortcodes( $content ); return $content; }
This should remove all shortcodes from page/post except ninja shortcode.
Once again i’m sorry for not be able to give You exact code…Good luck
MForum: Fixing WordPress
In reply to: Custom post type URL rewriteYou can dig into theme code…
Unfortunately i do not have that theme so from now on i can only guess…There should be a function somewhere called ‘register_post_type’ and/or ‘register_taxonomy’. They are responsible for creating custom post type and taxonomy for it. It can be in functions.php, files that are included in it, in some plugin if that theme provide some…
Both should have in argument array something like ‘rewrite’.
If there is nothing like it, then it would be the best position to start messing with the code:)Try to add
'rewrite' => array( 'slug' => 'someveryprettyslug' )
and see what happen.M
Forum: Fixing WordPress
In reply to: Custom post type URL rewriteWell,
Logitrans is a paid theme, and i would recommend to contact theme developer. They should provide You with the solutions.You can also try some rewrite plugin.
M
I do not think that this could break the layout. strip_shortcodes should only remove shordcodes from content.
If however this ovverride cause problems, that i think You should check the code that turnes gallery into a slider.
Maybe it strip shortcodes, because it works on all shortcodes that is present in given content, therefore if it find shortcode that is not a gallery it stops.
Can You provide more information about that gallery to slider changing functionality?
M
Hi,
Simpliest way would be to exclude that post/page from stripping:
function remove_shortcode_from_index($content) { global $post; if ( is_singular('portfolio') && 99 != $post->ID ) { $content = strip_shortcodes( $content ); } return $content; } add_filter('the_content', 'remove_shortcode_from_index');
Where ’99’ is ID of that specific post.
But that will allow all shortcodes on that specific post/page.Is that fit Your requirements?
M
Forum: Fixing WordPress
In reply to: Custom post type URL rewriteOk,
So how You created that custom post type?
What SEO plugin are You using?M
Forum: Fixing WordPress
In reply to: Editing disabledHi,
First of all i would restore whole site from backup, that You’ve created before update from WP3 to WP4.4.2.
Then it would be a good idea to update it manualy 3 to 3.1, check if everything is ok, then update to 3.2, check everything…
Long process, but can tell You between which versions this problem is created, what plugin stopped working. It’ll be simplier to find solution for problem that occur when updating from for example 3.6 to 3.7.
Or, if You are lucky, nothing wrong will happen and You end up with perfectly good instalation.Hope that helps
M.Forum: Fixing WordPress
In reply to: Tables couldn't be repairedHi,
Are You using WP eCommerce?
Are You in power of creating this tables via phpMyAdmin for example?
Or better, create clean instal of WordPress with WP eCommerce and then from that new database export that tables and import it to database of WordPress that creates that errors?When was first occurence of this problem? Did You update something, remove some plugin?
M.
Forum: Fixing WordPress
In reply to: Custom post type URL rewriteHi,
From Your example (“www.site.com/?service=california”) i assume that You have default permalinks setting active.
On Settings -> Permalinks setting ‘Post name’ or ‘Custom Structure’ would be a good start.
If You do not want to use any SEO plugins, look at WordPress rewrite API.
Hope that helps at least a little bit.
MForum: Fixing WordPress
In reply to: reset usernameHi,
If You do not have valid login and password, there is not much You can do without access to files and/or database.
If someone else can access admin panel, You could ask her/him to reset password and check username.
If You have access to database, You can replace password string with one from another instalation of WordPress, where You do have valid login and password.
If You have access to files, You can get credentials to database and follow previous step.
Hope that helps at least a little bit.
MichalForum: Fixing WordPress
In reply to: Need help to solve a code problemWell…
Main difference is that get_category_link exists and get_the_category_link do not.
I do that same mistake at least once a month:)
Greetings
MForum: Fixing WordPress
In reply to: Need help to solve a code problemHi,
Well, the piece of code in question is:
<?php $categories = get_the_category( ); $separator = ", "; $output = ''; if ($categories){ foreach ($categories as $category ) { $output .= '<a href="' . get_the_category_link($category->term_id) . '">' . $category->cat_name . '</a>' . $separator; } echo trim($output, $separator); } ?>
Have You tried to use :
get_category_link($category->term_id)
instead of:
get_the_category_link($category->term_id)
?Greetings
MForum: Fixing WordPress
In reply to: The requested URL / was not found on this serverForum: Fixing WordPress
In reply to: The requested URL / was not found on this serverHi,
It’s working page that stopped or You are currently installing it?
I assume that You checked that all wordpress files are where they should be?
Greetings
M