WPnerdzz
Forum Replies Created
-
Forum: Plugins
In reply to: [LiteSpeed Cache] How to log in/out users correctly?Hi, you are right, I checked response header and it was
X-LiteSpeed-Cache miss
I removed PHPSESSID to check it and it is showing
X-LiteSpeed-Cache hit,private
I logged out and logged in again and it seems to be working. Also tried user with subscriber role and that is working as well. looks like my problem is fixed. And it is probably not a good idea to hardcode Litespeed API on theme for flexibility.Forum: Plugins
In reply to: [WooCommerce] Unsanitize Custom Product Attribute?I needed a “Specification” tab where I could post an HTML table. I have done it using a plugin called Custom Product Tabs for WooCommerce
Forum: Fixing WordPress
In reply to: Developer friendly Post view count plugin?I have the plugin but I would rather not use it for security concern. And I should not be the only one who would need to sort posts by monthly or weekly views.
Forum: Fixing WordPress
In reply to: get_page_by_title() doesnt work if title has an apostrophe ( ‘ )The post title where I am adding this code is “Alex’s book collection”.
The other post I am trying to get info from is “Alex’s book collection – 1.9”Forum: Fixing WordPress
In reply to: get_page_by_title() doesnt work if title has an apostrophe ( ‘ )No no no…
The title in Post type: book is “Alex’s book collection”
In single book page, I am trying to post info from another post from different post type: release_link named “Alex’s book collection – 1.9”.
The title of this post type has a format like <book name> – <version>. I added a meta box in post type: book where I can enter book version (1.9 in this case).$lz_name = get_the_title().' - '.$lz_version; $lz_links = get_page_by_title($lz_name, OBJECT, 'release_link');
This works only if there is no inverted commas in book title.
You can download xampp portable and extract it in a pen drive. then you can carry it to wherever you want and work on any computer. or you can buy a hosting and make your project live and work via internet.
Forum: Fixing WordPress
In reply to: get_page_by_title() doesnt work if title has an apostrophe ( ‘ )bump
Forum: Fixing WordPress
In reply to: Images missing from Media Library and BlogAll of your texts and stuffs are messed up. Have you noticed a “\” before inverted commas?
I had a look at /?p=5299 and this is the state of texts.\”\”
Christopher Nolan has been often named as the new Generation\’s Stanley Kubrick which was cemented when he directed Interstellar- which was more of an ode to Kubrick\’s groundbreaking 2001: A Space Odyssey- Dunkirk seals it in as Nolan\’s version of \’Paths of Glory\’ and \’Full Metal Jacket\’.
I have no idea what happened to your site but some plugin screwed you up big time I assume.
You can search and replace using phpmyadmin. For example,
\’ => '
\" => "
CAUTION: BACKUP YOUR FULL DATABASE. I AM NOT RESPONSIBLE IF YOU LOSS YOUR DATABASE.
Login to phpmyadmin.
Navigate to your-database-name>wp_post table.
Click search tab>find and replace.
search for\’
and replace it with'
. Do in both post_content and post_title.
search for\"
and replace it with"
. Do in both post_content and post_title.
This should remove those unnesessery\
s and you should be able to see images.
CAUTION: BACKUP YOUR FULL DATABASE. I AM NOT RESPONSIBLE IF YOU LOSS YOUR DATABASE.Forum: Fixing WordPress
In reply to: get_page_by_title() doesnt work if title has an apostrophe ( ‘ )Thanks for the reply. My wordpress version was 5. Updated to 5.1 just now. It still doesnt work.
Here is the code in my theme.
$lz_version= get_post_meta( $post->ID, 'option_current-release', true );
a metabox with a number like1.9
.
$lz_name = get_the_title().' - '.$lz_version;
it echos something like “Alex’s book collection – 1.9
$lz_links = get_page_by_title($lz_name, OBJECT, 'release_link');
release_link is a custom post type. The titles of that CPT are like “Alex’s book collection – 1.9”
echo get_the_title($lz_links>ID);
it echos the title of current page “Alex’s book collection”, not desired “Alex’s book collection – 1.9”
But if I dont add any apostrophe, the code works fine.Forum: Fixing WordPress
In reply to: New site and can’t create a blank page or poistGo to settings>permalink and just press save button and see if it works.
Forum: Fixing WordPress
In reply to: How to display post type randomly in arguments?if(get_post_meta($post->ID, 'meta-key', true)) echo '<div class="whatever html u want">'. get_post_meta($post->ID, 'meta-key', true) .'</div>'; }
u can find meta key by inspecting the field in post editor. meta key usually be there as a class/id.
Forum: Fixing WordPress
In reply to: Update not workingWhich type of server are you using? set the permission of update-core.php to 777, do the update and then change it back to 755.
Forum: Fixing WordPress
In reply to: How to display post type randomly in arguments?I am posting an working random-posts-from-from-custom-taxonomy here.. I used it in my old theme and it is 100% functional. just clear the mess… sorry for messy snippet.
<?php // get the custom post type's taxonomy terms $custom_taxterms = wp_get_object_terms( $post->ID, 'genre', array('fields' => 'ids') ); // arguments $args = array( 'post_type' => 'albums', 'post_status' => 'publish', 'posts_per_page' => 13, // you may edit this number 'orderby' => 'rand', 'tax_query' => array( array( 'taxonomy' => 'genre', 'field' => 'id', 'terms' => $custom_taxterms ) ), 'post__not_in' => array ($post->ID), ); $related_items = new WP_Query( $args ); // loop over query if ($related_items->have_posts()) : echo '<div class="widget"><h4 class="related_head">Also Check Out</h4><ul class="related section group">'; while ( $related_items->have_posts() ) : $related_items->the_post(); ?> <li class="col2 x12"><div class="img"><a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail( 'small_thumb' ); } else { ?> <img width="60" src="/mp3/albumcover_min.jpg" alt="<?php the_title(); ?> Album thumb image" /> <?php } ?></a></div><div class="related_content"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><br/> <?php echo get_post_meta($post->ID, 'wpcf-total-songs', true); ?> Songs</div></li> <?php endwhile; echo '</ul></div>'; endif; // Reset Post Data wp_reset_postdata(); ?>
Forum: Fixing WordPress
In reply to: Can I Create Something Like this?Forum: Fixing WordPress
In reply to: How to display post type randomly in arguments?Offset: offset (int) – number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination. The ‘offset’ parameter is ignored when ‘posts_per_page’=>-1 (show all posts) is used.
source: codex