Tag Info

New answers tagged

0

The best way to create dynamic data outputs really depends on the what, why, and how. For example, if you're creating a theme that creates its own custom post type, say, to store information about the head honchos that run the business behind the site, then just create a "single-$CPTNAME.php" template that has the code that you want. Another method of ...


0

Basically you need to open your “wp-config.php” file in the root of your WordPress Install. Search for this line: require_once(ABSPATH . 'wp-settings.php'); And just before it add this code: define('CONCATENATE_SCRIPTS', false); Now your WordPress Install should be fixed! Source: ...


1

Create page templates inside your theme and create page-{template-name}.php for each one of them and you need to code the appropriate query for each case. Then go to each page inside admin panel, open each page and just assign each page to their matching template. If you are not familiar with how to do any of the above, provide the code of your current ...


-1

I have an idea! First, put the one copy of the list you want to edit into a widget with a text element. Second, place the widget on your page using a shortcode and this free plugin: Widgets on Pages Now, the same list appears on your site wherever the shortcode is placed!


3

What you are doing is incredibly dangerous. You can break your site horribly, or have your entire server hacked. With a PHP in content plugin there is nothing stopping an editor from copy pasting a PHP shell in to the content editor and taking full control of your site. If you have content on a page and want to include custom code, you should use one of the ...


0

The TypeError: wp.Uploader is undefined error is coming, because wp media editor file is not included. Please check for this.


2

Your code will never get to the is_page_template() if statement because is_page_template() can only be true when is_page() is also true. It also looks like you've got some muddled elseif syntax (I think that's what you want?) and some generally inefficient code that repeats a lot. I'd do this: <?php if( is_page_template('right-sidebar.php') ) { // ...


-1

<?php the_post(); // $postType holds all the information of the post type of the current post you are viewing $postType = get_post_type_object(get_post_type()); // $postSlug is the slug you defined in the rewrite column: about/team-members $postSlug = $postType->rewrite['slug']; // $datas = { [0] => 'about', [1] => 'team-members' } $datas = ...


0

A possible solution is whenever the custom post type is saved, you can set its' parent to be about/team-members prgrammatically. Here are the steps: You can use the save_post hook to 'catch' whenever someone tries to save a post. If that post is the custom post type you are after, then proceed. Make sure to set the custom post's parent to the page you ...


0

I had some more time to dig into this myself (sorry if I wasted anyone's time), and I figured that for me, the best way to solve the highlighting problem would be to kinda re-do what _wp_menu_item_classes_by_context() is doing, that is iterate over all parents and ancestors of the menu item that acts as the parent of my custom post type, and add classes ...


0

Disclaimer: After giving it a try this seems a not longer existing problem to me, because - at least for me - it just works on my WP 3.9.2 installation. Couldn't find a according bug tracker though. I have out together a little plugin to test this, which might help someone. But like I said in above disclaimer, I couldn't reproduce the problem in a current ...


0

$query = new WP_Query( 'pagename=about' ); // The Loop while ( $query->have_posts() ) { $query->the_post(); ?> <header class="entry-header"> <h2 class="entry-title"> <?php the_title(); ?> </h2> </header> <div class="entry-summary"> <?php the_excerpt(); ?> ...


0

EDIT Seems that I some how misunderstood you. I do think you are missing the point of the post_excerpt. When you create a new post or page (AFAIK for pages as well), you have the opportunity to create a manual excerpt in the excerpt meta box (to make it available, just enable it in screen options dropdown when in the add new/edit post/page screen). This ...


0

Add this code into functions.php, it will add support for excerpts in Pages <?php add_action('init', 'my_custom_init'); function my_custom_init() { add_post_type_support( 'page', 'excerpt' ); } ?> Use this to show up the excerpt.. $pages = get_pages(array ('post_type' => 'page','sort_column' => 'menu_order')); foreach ...


0

This is quite a vast question to answer, so I'm not going to go into depth, I'm just going to cover the essential points. You'll need to create a custom query to get all the data from your pages. Use WP_Query to create your custom query. Here is a basic query from the codex to get your pages <?php // The Query $the_query = new WP_Query( ...


0

This is what I did on a recent site: $blog_page_object = get_queried_object(); $blog_page_title = $blog_page_object -> post_title; $blog_page_description = apply_filters('the_content', $blog_page_object -> post_content ); ?> <h1><?php echo( $blog_page_title ) ?></h1> <?php echo( $blog_page_description ) ?>


0

I found a plugin that resolved my problem : revisionary https://wordpress.org/plugins/revisionary/


0

For your authors you need to set accounts with a "contributor" role. A contributor can writ content but can't publish it. Then create a user for your editor and give him an "editor" role and he will be able to publish the content the authors had written. The main problem you may run into is that contributors can not upload images. If you trust your authors ...


4

This is a shortcode you see there in the post/page content. It's most likely displaying all the child pages (up to depth 1) of the current page. Shortcodes are very common, but you can't see their output in the WordPress post/page editor, only on the front end where it's generated via the do_shortcode() function. The "hard" way: So you can try do the ...


0

You are using too many static pages. Pages are hierarchical and wordpress doesn't handle page that well. The same goes for Custom Post Type with hierarchical option set. The only solution here is to ask your host to increase your RAM size. That will solve the problem for now. But if you continue to add too many pages again, you are again to hit the memory ...


1

You could modify it through the the_author filter: /** * Set the author name as the site title. */ ! is_admin() && add_filter( 'the_author', function( $author ) { return get_bloginfo( 'name' ); } ); where we change the author name to the site name on the frontend with the help of the get_bloginfo() function.


1

According to the Codex, your custom page template must have a header containing the name of the template. All page templates must be named in this way, or they will not appear in the "Template" dropdown. Here's an example, make sure your custom template has a header in this format: <?php /* Template Name: My Custom Page */ // Your custom page template ...


2

May be something is wrong on your page template file. Have your added page template name at top of the page like this: <?php /* Template Name: My Custom Page */ Try with this and check once again. You can check WordPress document for creating custom page template. Check this link: Page Templates


1

after you delete a page ,on the "all pages" section, on the top, after the "drafts", there is link to trash, go there and delete it permanently, after this you can change the slug name.


0

Try Howdy_McGree suggestion. If that does not work, try changing your permalink structure, going to that page, resaving it to what you want, and changing your permalink structure back. Sometimes you kinda have to force WP into a reset.


1

Instead of having a page template for all of them, have a single page template and use get_template_part to pull in the parts unique to each page. So instead of: update_post_meta($new_page_id, '_wp_page_template', $page_filename); You'd have: update_post_meta( $new_page_id, '_wp_page_template', 'newpagetemplate.php' ); update_post_meta( $new_page_id, ...


0

You can tie it to the 'wp_head' hook. http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head


0

What about admin_init ? Description is: admin_init is triggered before any other hook when a user accesses the admin area. This hook doesn't provide any parameters, so it can only be used to callback a specified function.


0

You can use this function wp_trim_words(). It allows you to format the output, and strips all the HTML tags in the content (it uses wp_strip_all_tags). You will have to pass post_content as the first paramenter.


-2

Has you are requesting the excerpt of every post inside your query, you need to setup your post data for each post. $args = array( 'child_of' => 16, 'title_li' => '', 'depth' => 0, 'sort_order' => 'DESC', 'sort_column' => 'menu_order' ); $pages = get_pages( $args ); $output = ''; foreach($pages as ...


0

My code is working @ialocin If you want to use my code for a map on your wordpress site, you've to do 6 things. 1 -- Follow songdogtechs 3rd suggestion 2 -- Paste my code into wordpress' page editor with the text tab, not visual 3 -- Surround my code with the no format tags <!-- noformat on --> 'ALL MY CODE IN BETWEEN' <!-- noformat off ...


1

For things like that a page is better option, because you can make use of custom page templates and also because pages are a better place for inner secondary queries. As example, if you want to use pagination for secondary queries, alongside next_posts_link() and previous_posts_link(), both those functions check if ( ! is_single() ) to display pagination ...


0

The ../page/X structure ties to pagination, not to post names. I'm sure you could change them but I'm not sure how deep the effects of the change would be. Have you thought about an alternate solution? Name each post your chapter name Forward Chapter 1 Chapter 2 Add a plugin that adds previous / next navigation functionality each individual post. ...


0

You can use the Search and Replace plugin to fix the URLs once the new domain is chosen. Likewise, plugins such as BackupBuddy (paid) or Duplicator (free) -- which are very useful for backup, possibly coupled with migration to another server or domain -- also perform this search-and-replace operation.



Top 50 recent answers are included