One folder to be accessible by one user

One solution might be to directly restrict access to the file on the server, but utilize a url rewrite to display the content — only if the id matches in the request. Obviously this doesn’t answer every question in the scenario but it does provide a proof-of-concept to indirectly convert a url into a file. … Read more

How make wp_nav() with my css?

First step is to register the name (or names) for your menus. In your example, top-nav seems appropriate. function vd_register_menu() { register_nav_menu(‘top-nav’,__( ‘Top Nav Menu’ )); } add_action( ‘init’, ‘vd_register_menu’ ); This will allow you to build your menu items in the WP admin under Appearance > Menus. To display your menu on the site, … Read more

How to create a loop that will display one post and stop?

query_posts() can alter the WP query even when it is executed and it should be placed at least before you start the loop i.e. have_posts(). Currently you are placing it after setting up post data i.e. the_post(). Which is resulting in unexpected behavior. Example: global $query_string; //Get current query arguments query_posts($query_string.”&featured=yes”); if (have_posts()) { while … Read more

How to create a loop where loop changes every post?

The PHP modulus operator gives you the remainder from dividing 2 numbers. The remainder from the division of any number by two is either 0 or 1, so we can use that to provide an “alternator”. We use the current_post var as a counter, which is available in any WP_Query object: while( have_posts() ){ the_post(); … Read more

WP and Laravel integration (Updated) [closed]

There is no “generic” way to just smash WP with another app and have it work. It can be roughly split in two cases: Applications run separately on server, installed in different directories, and styled to look as one site (possibly talking to same database, possibly talking to each other via REST API or something). … Read more

Show wrapper divs if query has results, then loop the results [closed]

Your second query was built up a little incorrectly – expanded and indented, it looks like this: if ($portfolio->have_posts()) : while($portfolio->have_posts()) : $portfolio->the_post(); ?> <div class=”other-post col-sm-6 col-xs-12″> <ul style=”color:#f0ad4e;”> <?php if($portfolio->have_posts()) : while($portfolio->have_posts()) : $portfolio->the_post(); ?> <li><h2><a href=”https://wordpress.stackexchange.com/questions/248440/<?php the_permalink() ?>” target=”_blank”><?php the_title(); ?></a></h2></li> <?php endwhile; endif; wp_reset_query(); ?> </ul> </div> You’re starting the last … Read more

New to wordpress. Need Help with templates [closed]

The blog page of my site has the same design as homepage You are in a full control of design in theme. It only does what you code/style it to do. For general direction you need to learn and understand how templates are named/selected and native body classes which WP applies and makes available for … Read more

how to get image url from meta value?

This is a serialized array value in the database. WordPress serializes arrays as a way of storing structured data in the database. You need to use get_post_meta() to get the post meta data value, something like this: $array = get_post_meta($post_id, ‘meta_data_key_name’, TRUE); // add the meta data key name Then, you can print the content … Read more

How I can give a php page a style from my theme

There are three css files in your not-styled-like-my-theme page and none of them are coming from the writr theme. The goal you want is to get the writr theme’s css on that page. Unfortunately, I did this in Google Chrome and the results are probably not what you’re looking for. This means your page and … Read more