How to remove ?p= from wordpress short links

I am not sure how you removed ?p= from the link but you can use get_shortlink filter to override the shortlink. You can refer following article for more details. http://www.wpbeginner.com/wp-themes/how-to-display-wordpress-shortlinks-in-your-theme/ Reference to get_shortlink filter: https://developer.wordpress.org/reference/hooks/get_shortlink/ Can you share some more details on how you removed the ?p= from the link?

Show About and Contact Us page when they’re clicked in the top menu.

You need to include a loop to retrieve the page content. Something like: <div id=”primary” class=”site-content”> <div id=”content” role=”main”> //BELOW HERE <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( ‘content’, ‘page’ ); ?> <?php comments_template( ”, true ); ?> <?php endwhile; // end of the loop. ?> //ABOVE HERE </div><!– #content –> </div><!– … Read more

Search form does not work in my website

You’re missing the name of the search text input, so replace: name=”” with name=”s” Then take a look at searchform.php in the default themes, like Twenty Sixteen: <form role=”search” method=”get” class=”search-form” action=”<?php echo esc_url( home_url( “https://wordpress.stackexchange.com/” ) ); ?>”> <label> <span class=”screen-reader-text”><?php echo _x( ‘Search for:’, ‘label’, ‘twentysixteen’ ); ?></span> <input type=”search” class=”search-field” placeholder=”<?php echo … Read more

How can i show post_class() within output loop?

You should use get_post_class() From Codex: get_post_class() is not simply a non-echoing alternative to post_class(). get_post_class() does not return a string, but an array that must be processed to produce text similar to what is echoed by post_class(). So $classes = get_post_class(); $output=”<div id=”” . get_the_ID() . ‘” class=”‘ . implode(” “, $classes) . ‘”></div>’;

Use Tags to initiate Search

I used a workaround for now. I eddited the category_template.php with the str_replace function. The problem turned out to be that the Tag Cloud used diffenten functions than the regular Tags. I just added this: foreach ( $tags_data as $key => $tag_data ) { $class = $tag_data[‘class’] . ‘ tag-link-position-‘ . ( $key + 1 … Read more

How to create table in wordpress without plugin? [closed]

I am not sure i understand the question but if ur looking to create a table you can do it with simple HTML and CSS. Take a look at this: https://www.w3schools.com/html/html_tables.asp Again, if you need this in all posts then you might consider adding this code inside your theme’s loop.php (or other equivalent file which … Read more

How to loop through all the attached images in a post, and get their url one by one

Put this in the template file at the beginning or in functions.php file: function get_images_attachment_url() { global $post; $images_urls = array(); $images_objects = get_attached_media( ‘image’, $post->ID ); foreach ($images_objects as $image_object) { $images_urls[] = wp_get_attachment_url ($image_object->ID); } return $images_urls; } When you need to call them use foreach after calling the function get_images_attachment_url(): $my_images_urls = … Read more

Error using WordPress $wpdb object to get result from custom table

I have checked your code and I think there are the couple of things you have to consider: table prefix column name validate get_results function output Firstly, the original prefix is defined in wp-config.php. The WordPress $wpdb class provides a variable $prefix. Always use $wpdb obefore table name and it will automatcially insert the table … Read more